Load a Related Record in a Subform with a Command Button (1 Viewer)

asanjose

Registered User.
Local time
Yesterday, 21:37
Joined
Mar 2, 2010
Messages
14
Good morning and thanks for viewing :)

Is there a way to load a related record in a subform using a command button?

I'm only able to load a related record by launching a new form/window, but it's going to get messy with so many forms/windows open.

I have attached an image to better explain what I'm trying to do.
Any help would be very much appreciated.

Regards,
asj

 

Attachments

  • subform loads related record.jpg
    subform loads related record.jpg
    78.1 KB · Views: 390

vbaInet

AWF VIP
Local time
Today, 02:37
Joined
Jan 22, 2010
Messages
26,374
1. Create a form for Invoice Details
2. Apply the form as the subform in the Invoice Details tab by setting the Control Source of the subform object to the form you created in 1
3. Use Master-Child links to link the InvoiceID to your subform control.
4. When the user clicks view, just "go to" the page.
Done!
 

asanjose

Registered User.
Local time
Yesterday, 21:37
Joined
Mar 2, 2010
Messages
14
1. Create a form for Invoice Details
2. Apply the form as the subform in the Invoice Details tab by setting the Control Source of the subform object to the form you created in 1
3. Use Master-Child links to link the InvoiceID to your subform control.
4. When the user clicks view, just "go to" the page.
Done!

Thanks for the quick reply!

I think you are right on target. I'm just not sure how to do:

Step 3. Use Master-Child links to link the InvoiceID to your subform control.

I will look it up.

Thanks again!
asj
 

vbaInet

AWF VIP
Local time
Today, 02:37
Joined
Jan 22, 2010
Messages
26,374
Step 3. Use Master-Child links to link the InvoiceID to your subform control.
When you drop the subform control onto your form a wizard pops-up. Follow the wizard and there's a section where it asks you which fields you want to use to link the subform control to the main form.

Once created, you can also view the Link Master Fields and Link Child Fields properties by clicking the subform control once, go to the Property Sheet and click on the Data tab.
 

asanjose

Registered User.
Local time
Yesterday, 21:37
Joined
Mar 2, 2010
Messages
14
When you drop the subform control onto your form a wizard pops-up. Follow the wizard and there's a section where it asks you which fields you want to use to link the subform control to the main form.

Once created, you can also view the Link Master Fields and Link Child Fields properties by clicking the subform control once, go to the Property Sheet and click on the Data tab.


Thank you! It worked. I had trouble at first because my main form was unbounded and the field/data that I wanted to link was between two subforms in different tabs.

I was only able to change the master/child link after bounding the main form. Then I unbounded it afterwards.

For the first subform (Invoices) to pass on data to the second subform (Details), I just had an unbounded text box on the main form for them to share.

 

Attachments

  • subform loads related record 2.jpg
    subform loads related record 2.jpg
    63.7 KB · Views: 503

vbaInet

AWF VIP
Local time
Today, 02:37
Joined
Jan 22, 2010
Messages
26,374
Excellent! That's another way too.

Some extra ideas, it might be good for you to disable that Page (i.e. Invioce Details page) until the user clicks VIEW from the Invoice page, which causes it to be enabled.

Or

Allow the user to view all Invoice Details irrespective of the Invoice Number, but when VIEW is clicked it shows only the related record.

Not sure how your invoice details is laid out but just as an addendum.

Glad it worked. Have fun!
 

Users who are viewing this thread

Top Bottom