Open form on specific tab

  • Thread starter Thread starter CFP - Russell
  • Start date Start date
C

CFP - Russell

Guest
Hey guys,

I've searched this forum up and down however I cannot find the answer to my problem. I have a form with multiple tabs, and I want to be able to open the form with a specific tab open. I know this must be possilbe, I just can't figure out how to do it.

Any help would be greatly appreciated.

Thanks,
Russell
 
in the On_Open event for the form enter:

Page2.SetFocus

'where Page2 is the NAME of the page you would like to see.
 
Won't that open the form to that tab everytime?

Let me explain in more detail what I want to do. I have a customers form with tabs for various customer information, ie (address, contact information, call history).

I also have another form with a button called contact information. I want this contact information button to open the customers form with the contact information tab open. And when the customers form is open by itself, I want it to just go to the defaulted first tab as usual.

Thanks,
Russell
 
Use the OpenArgs method of the OpenForm method to tell the customers form that it is being opened by the contact information button. Check for the value of the OpenArgs in the open method of the customers form and have it go to the appropriate page if the form was opened by the contact information button.
 
Code:
Private Sub YourButton_Click()
On Error GoTo Err_YourButton_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "YourFormName"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    Forms![YourFormName]!YourPage.SetFocus

Exit_YourButton_Click:
    Exit Sub

Err_YourButton_Click:
    MsgBox Err.Description
    Resume Exit_YourButton_Click
    
End Sub


IMO
 
Thanks everyone for their replies. IMO, I tried your code and I'm getting a syntax error. Access keeps telling me to put the page number in brackets. When I do that, I get another error telling me that Access can't find the field 2. (I'm using page 2 in the tabs)

Thanks,
Russell
 
Ok, Rich got there first :D


IMO
 

Users who are viewing this thread

Back
Top Bottom