Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Navigating between forms 1

Status
Not open for further replies.

kulani

Programmer
Nov 15, 2006
1
0
0
ZA
I have two forms which both connect to the SQL server. The forms run but the issue is the following: on the one form is you have to enter the clients id and name. when you click the process button , it takes you to the second form. I want the code to populate the specific client's id information on the form. so far its giving me all the clients information.
 
One method is to create public modular variables for the client ID on the second form. Then set these variables from the first form before the second form is shown.

Use the values in these variables to get the specific information for the client ID you have passed. This can be done in the form load or activate event.

zemp
 
If you are opening the second form each time that you press the Process button, an alternative would be to pass the client ID as an OpenArgs option so the calling line would be:

DoCmd.OpenForm stDocName,,,,,,strClientID

In the Form - Activate event for the receiving form you can then test for OpenArgs and display the relevant record.

The code would look like the following:

If Not IsNull(Me.OpenArgs) Then
strClientID = Me.OpenArgs
Me.txtClientID = strClientID
Me.requery

End If
 
Errmmm....
This is a VB forum, not VBA

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top