Link to home
Start Free TrialLog in
Avatar of bagoglia
bagogliaFlag for United States of America

asked on

Same Record ID from Form to Form

I am an old FoxPro programmer from back in the 90's but haven't done much with Access until now. I created a navigation form which I have 4 tabs that open 4 different forms. Each form is connected to a different table and one form is connected to a summary query. There are three tables and one query which all have a record_id field that joins them together.

If someone could please tell me the proper syntax and where the code should go so that when I click a tab the form I enter is on the same record_id as the form I left.

If it matters I am using Access 2010.

Thanks for your help!
Avatar of Luke Chung
Luke Chung
Flag of United States of America image

Welcome to the Access community. I originally started way back in the Paradox DOS days. Getting used to Access requires learning how things are done in Access, so this is a good step.

There are a few ways to pass information around. You can of course use a global variable, but that's not very self-contained.

In your situation, passing the value in the OpenArgs parameter of the DoCmd.OpenForm command probably works best.

From the called form's OnLoad or OnOpen event, you can check to see if the Me.OpenArgs parameter is set, get the value, then do whatever you want with it.

For a more advanced way to pass multiple values in the OpenArgs parameter, read this paper we wrote: Passing Multiple Values to Microsoft Access Forms and Reports with the OpenArgs Parameter
http://www.fmsinc.com/free/newtips/access/accesstip13.asp

You may also want to signup for our email newsletter which offers resources for Access developers on a regular basis. Hope this helps.
SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh yes, if you're not familiar with how to use subforms so you don't need to open another form, that's much better and requires no code.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bagoglia

ASKER

OK boag2000.  I like this idea.  I created a new nav form and added the combo box but I don't see where to set the Child-Master links.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks guys.  With my rusty Foxpro skills and your suggestions I am able to make it work!
I guess you found the Child-Master links....
;-)
Yes.  Thanks!