Going to a specific tab

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a tabbed form that have "Clubs" and "Grocery", etc that opens up when
the user clicks on Club field or Grocery field or the other opeing in the
main form. I been trying to go to specific tab based on which field was
clicked - ie click on Club the form opens up with the CLUB tab on display,
Click on grocery and the GROCERY tab will on displayed, etc. I've tried
everything but the form still opens up with CLUBS (being the first tab) even
if you click on the Grocery, Warehouse, etc. Need help please.
 
Pass the field that was clicked to the tabbed form as the OpenArgs value.
Then, in the Open eventof the tbbed form, check the OpenArg value and set
the tabcontrol's value to display the appropriate page.

Something like:
In the main form's click event for a particular field
...
DoCmd.OpenForm "frmTabbedForm", , , , , , "Club"
'substitute the appropriate field name for the different field's click
events
...
and in the tabbed form's Open event
Select Case OpenArgs
Case "Club"
Me.ctlTab.Value = 0 'assuming Club tab is 0; change as appropriate
Case "Grocery"
Me.ctlTab.Value = 1 'assuming Grocery tab is 1; change as appropriate
...
Case Else
Me.ctlTab.Value = 0 'default to tab page 0
End Select

HTH,

Rob
 
You can't use a tab control's CLICK event reliably as it is almost useless
because it won't actually fire from the tab part. You need to use the On
Change event of the tab control to determine which tab was clicked and then
to do whatever code you need.
 
Hi Bob,

The OP is clicking in a field on the main form to open the tabbed form;
that's the Click event I'm referring to. Neither the OP nor I have referred
to the Click event of a tab control.

Rob
 
That fixed the problem thank you!

Rob Parker said:
Hi Bob,

The OP is clicking in a field on the main form to open the tabbed form;
that's the Click event I'm referring to. Neither the OP nor I have referred
to the Click event of a tab control.

Rob
 
Back
Top