mtrussell
asked on
Add record to form on a tab folder
I have a form that has a tab control with three different tabs. Each tab has it's own subform added to each tab. I have a button to add record but I can't figure out in VBA how identify which tab is active then add a record to the subform that is active. Any help would be appreciated. I am using Access 2007.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I think I wasn't very clear on this example.
I have an unbound form and it has a tab control. On the unbound form it says add new record. I need to identify the tab which is open and then ADD a record to the form which is active. There are technically three subforms on this form and add a record needs to add it to the appropriate subform.
I have an unbound form and it has a tab control. On the unbound form it says add new record. I need to identify the tab which is open and then ADD a record to the form which is active. There are technically three subforms on this form and add a record needs to add it to the appropriate subform.
Well, the code I posted shows how to identify the current 'Active' tab.
mx
mx
ASKER
Answer pointed me in right direction to complete.
Private Sub Command2_Click()
Dim x
For x = 0 To Me.TabCtl1.Pages.Count - 1
If Me.TabCtl1 = x Then MsgBox "active tab is " & x & " " & Me.TabCtl1.Pages(x).Name
Next x
End Sub
mx