[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 521
  • Last Modified:

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!
0
bagoglia
Asked:
bagoglia
  • 3
  • 3
  • 3
3 Solutions
 
Luke ChungPresidentCommented:
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.
0
 
Jeffrey CoachmanCommented:
Then first you should be entering this "record_id" in the main form.

Then set the Master-Child subform links to this Field/Control.

Then synchronizing the forms is automatic.
0
 
Luke ChungPresidentCommented:
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.
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
Jeffrey CoachmanCommented:
Sample attached
Database64.mdb
0
 
bagogliaAuthor Commented:
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.
0
 
Luke ChungPresidentCommented:
Here are two papers you may find helpful:

This shows the property settings:
Microsoft Access Subforms Should Reference the Control Rather than Field for Master Link Fields
http://www.fmsinc.com/microsoftaccess/forms/subform/master-link-fields.asp

Synchronize Two Related Subforms on a Microsoft Access Form
http://www.fmsinc.com/microsoftaccess/forms/synchronize/linkedsubforms.asp
0
 
bagogliaAuthor Commented:
Thanks guys.  With my rusty Foxpro skills and your suggestions I am able to make it work!
0
 
Jeffrey CoachmanCommented:
I guess you found the Child-Master links....
;-)
0
 
bagogliaAuthor Commented:
Yes.  Thanks!
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 3
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now