Open a form to a specific tab

BJF

Registered User.
Local time
Today, 13:47
Joined
Feb 19, 2010
Messages
137
Hello,

I am wondering if anyone can help me out in opening up a form to a specific tab through vba.

Ive got a form with a product field. When i double click that field, it opens up another form with product details.

I use the following code on the field:


Private Sub ProductNum_DblClick(Cancel As Integer)

DoCmd.OpenForm "frmStandardCostNewer", acNormal, , "[ProductNum]='" & Me![ProductNum] & "'"

End Sub


It works fine, only the form it opens has 3 tabs and i want to know if it is possible to open it up to the second tab of the form.

Any help would be appreciated.
Thanks,
BJF
 
thanks ranman,
however would you possibly be more specific in how to incorporate that into my vba?

DoCmd.OpenForm "frmStandardCostNewer", acNormal, , "[ProductNum]='" & Me![ProductNum] & "'"

thanks,
BJF
 
I'm not going to set up two tables and forms, to include the [ProductNum], and so forth, but omitting that, the following syntax works

Code:
DoCmd.OpenForm "frmStandardCostNewer", acNormal, , , , , "Tab2"
so I expect that the following will, as well:

Code:
DoCmd.OpenForm "frmStandardCostNewer", acNormal, , "[ProductNum]='" & Me![ProductNum] & "'", , , "Tab2"

Now, in frmStandardCostNewer, use this

Code:
Private Sub Form_Load()
 If OpenArgs = "Tab2" Then
  Me.TabControlName = 1
 End If
End Sub
Note that the Page Index for Tabbed Pages is Zero-based, so the second Page 's Index is 1...not 2.

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom