I want to create button on tab control with VBA from different form. When i click to create button than with vba other form will open in a design view and create button on specific tab page.
example i have four tab pages page1 page2 page3 page4 now i want to create button on page 2
Private Sub pos_Click()
Dim FormName As String
Dim tab_page As pages
Dim frm As form
Dim tab_control as Control
FormName = "pos"
DoCmd.OpenForm FormName, acDesign
Dim newBt As Control
Set frm = Forms!pos
Set tab_control = frm!pos_products
Set tab_page = tab_control!pages(1)
Set newBt = CreateControl(frm.name, acCommandButton, Left:=100 + 3000, Top:=500)
End Sub
example i have four tab pages page1 page2 page3 page4 now i want to create button on page 2
Private Sub pos_Click()
Dim FormName As String
Dim tab_page As pages
Dim frm As form
Dim tab_control as Control
FormName = "pos"
DoCmd.OpenForm FormName, acDesign
Dim newBt As Control
Set frm = Forms!pos
Set tab_control = frm!pos_products
Set tab_page = tab_control!pages(1)
Set newBt = CreateControl(frm.name, acCommandButton, Left:=100 + 3000, Top:=500)
End Sub
Last edited: