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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate field with value from another open form

Status
Not open for further replies.
Feb 6, 2003
22
US
I have a "Jobs" form with the Primary Key - JobID. The form has a "Detail" button which opens the "Delivery Detail" Form that displays data from a child table.

I would like the Delivery Detail JobID to automatically be set to the JobID from the parent table\form.

How can I go about this? And where would I stick the code in?

Thanks,

Michelle
 
You shouldn't have to write any code. Set up the relationship (join) first, then insert the child form into the main form as a subform (possibly hiding it until the "Detail" button is pressed). Acess will automatically link the two forms based on the relationship you defined previously. Pressing the "Detail" button can then unhide this subform.

If you don't want to use the subform method (for various reasons), you may have to write one very simple line of vb code to insert the JobID into the child form.

Please specify how your database is set-up, including PKs, joins etc. It makes answering your question much easier.
 
Yes, I'd rather not use a subform. Here are the details

Form 1) Table=LogJobs, Form=ViewLogJobs, PK=LogJobID

Form 2) Table=Delivery, Form=Delivery, PK=DeliverID, FK=LogJobID

There is a one-to-many relationship between LogJobs and Delivery.

LogJobID from ViewLogJobs is the value that I want to appear on Delivery in the field named LogJobID.

Let me know if I left out any relevant info...

Thanks, Michelle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top