Going to a specific tab

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.
 
R

Rob Parker

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
 
G

Guest

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.
 
R

Rob Parker

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top