Solved Form and subform (1 Viewer)

nosrepmynona

New member
Local time
Today, 08:32
Joined
Apr 25, 2020
Messages
6
Hi,
Maybe I don´t use correct defintion to describe, but I hope you understand what I mean.
I have made two queries and each query are linked to separate tables. Each table has relations to one other table, but they are not the same. In each query I can specify my question via msg box using "[...]" in the criteria field. Both queries has the same column asked from, for example in table 1 type a specific postcode number end a table is shown with specific data. In query 2 I type the same postcode and other info is shown.

Now, I would lika to make a form with a form field so I only need to type the postcode once there, and table 1 and table 2 is shown as a form and a subform. I hope you can point me in the right direction like, do I need to type VBA-code to make it happend and so on. I´ve managed to do two separat forms, but I can't make it work with a form and a subform.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:32
Joined
Oct 29, 2018
Messages
21,454
Hi. If you managed to do it with a form, did you use something like this for the criteria in the query?

Forms!FormName.ControlName

If so, are you saying the query doesn't work when you use the same form as a subform? If so, you'll have to change it to this:

Forms!FormName.SubformName.Form!ControlName

Hope that helps...
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 07:32
Joined
Jul 9, 2003
Messages
16,271
I think you need to set up the form and subform arrangement correctly. If you do that, when you choose a record in the main form with a postcode then the subform will show the related information automatically.

When you choose the postcode in the other form then you only need to pass that through to the main form and the main form will manage how the data is displayed in the subform.
 

nosrepmynona

New member
Local time
Today, 08:32
Joined
Apr 25, 2020
Messages
6
Ok, thank you. I´ve tried to set up an example file to visualise what I mean, please se attached file.
In the original file it´s a little bit more complicated with more tables and relations.
 

Attachments

  • Example.zip
    41.6 KB · Views: 87

nosrepmynona

New member
Local time
Today, 08:32
Joined
Apr 25, 2020
Messages
6
Thanks both of you, It works now! I had to make som corrections both in the criteria section and set up of the form and subform correctly. Now it works exactly as I wanted!!
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:32
Joined
Oct 29, 2018
Messages
21,454
Thanks both of you, It works now! I had to make som corrections both in the criteria section and set up of the form and subform correctly. Now it works exactly as I wanted!!
Hi. Congratulations! Good luck with your project.
 

Users who are viewing this thread

Top Bottom