Access.2007.VBA.Bibl..

(John Hannent) #1
chk = appAccess.CreateControl(FormName:=frm.Name, _
ControlType:=Microsoft.Office.Interop.Access.AcControlType.acCheckBox, _
Section:=Microsoft.Office.Interop.Access.AcSection.acDetail, _
Left:=0, Top:=4000, Width:=2500, Height:=400)

ErrorHandlerExit:
Exit Sub

ErrorHandler:
AddInErr(Err)
Resume ErrorHandlerExit

End Sub

Public Sub CreateNewReport(ByVal control As _
Microsoft.Office.Core.IRibbonControl)

On Error GoTo ErrorHandler

Dim rpt As Microsoft.Office.Interop.Access.Report
Dim txt As Microsoft.Office.Interop.Access.TextBox
Dim lbl As Microsoft.Office.Interop.Access.Label
Dim cbo As Microsoft.Office.Interop.Access.ComboBox
Dim lst As Microsoft.Office.Interop.Access.ListBox
Dim chk As Microsoft.Office.Interop.Access.CheckBox

Create a new report.

rpt = appAccess.CreateReport()
rpt.RecordSource = “tblTest”
txt = appAccess.CreateReportControl(ReportName:=rpt.Name, _
ControlType:=Microsoft.Office.Interop.Access.AcControlType.acTextBox, _
Section:=Microsoft.Office.Interop.Access.AcSection.acDetail, _
Left:=0, Top:=0, Width:=2500, Height:=400)

lbl = appAccess.CreateReportControl(ReportName:=rpt.Name, _
ControlType:=Microsoft.Office.Interop.Access.AcControlType.acLabel, _
Section:=Microsoft.Office.Interop.Access.AcSection.acDetail, _
Left:=0, Top:=1000, Width:=2500, Height:=400)

cbo = appAccess.CreateReportControl(ReportName:=rpt.Name, _
ControlType:=Microsoft.Office.Interop.Access.AcControlType.acComboBox, _
Section:=Microsoft.Office.Interop.Access.AcSection.acDetail, _
Left:=0, Top:=2000, Width:=2500, Height:=400)

lst = appAccess.CreateReportControl(ReportName:=rpt.Name, _
ControlType:=Microsoft.Office.Interop.Access.AcControlType.acListBox, _
Section:=Microsoft.Office.Interop.Access.AcSection.acDetail, _
Left:=0, Top:=3000, Width:=2500, Height:=400)

Part III Adding More Functionality to Office

Free download pdf