Access.2007.VBA.Bibl..

(John Hannent) #1

Create the table.


appAccess.DoCmd.RunSQL(strSQL)

ErrorHandlerExit:
Exit Sub

ErrorHandler:
AddInErr(Err)
Resume ErrorHandlerExit

End Sub

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

On Error GoTo ErrorHandler

Dim frm As Microsoft.Office.Interop.Access.Form
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 form.


frm = appAccess.CreateForm()
frm.RecordSource = “tblTest”
txt = appAccess.CreateControl(FormName:=frm.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.CreateControl(FormName:=frm.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.CreateControl(FormName:=frm.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.CreateControl(FormName:=frm.Name, _
ControlType:=Microsoft.Office.Interop.Access.AcControlType.acListBox, _
Section:=Microsoft.Office.Interop.Access.AcSection.acDetail, _
Left:=0, Top:=3000, Width:=2500, Height:=400)

Customizing the Access Ribbon with a Visual Studio 2005 Shared Add-in 16

Free download pdf