Help with Linking two sub-forms (1 Viewer)

Planeman

New member
Local time
Today, 20:40
Joined
Sep 3, 2020
Messages
10
Good Afternoon

I have just joined access world, because i am in the process of trying to create my own database.

The 2 problems i am having, is I have 2 sub-forms on a form, one called index, one called details.

What i would like to do is as i scroll through the index form, the full data from the table appears on the details form, I just cannot find a way of linking the two to make this happen. (Example attached)

The second problem is, what i would like to do is have a screen with a list of aircraft types, and when i click on a type the above form opens, but filtered just for that type

I hope I am not asking to much, and wonder whether somebody could take a look at my database and correct what i am doing wrong....

Many thanks in advance

Richard
 

Attachments

  • Test Database to replace excel.zip
    38.1 KB · Views: 91

theDBguy

I’m here to help
Staff member
Local time
Today, 13:40
Joined
Oct 29, 2018
Messages
21,358
Hi Richard. Welcome to AWF!

I haven't looked at your file, but If you're saying the second subform is linked to the first subform, then one of the most common approach is to use an unbound Textbox on the main form to reference the linking field in the first subform. You would then link the second subform to that Textbox.
 

neuroman9999

Member
Local time
Today, 15:40
Joined
Aug 17, 2020
Messages
827
Richard,

regarding the filtering of a form when it is opened, lookup up the method call docmd.openform(). there is an arg taken in their called filter. that's what you need. there is also another arg called where condition. either one of those can do for you what you want.

regarding the linking of the forms, if these 3 forms you are talking about are stacked in a way where they are all related, primarily by one-to-many relays, more than likely you can do what you want by tinkering with the object dependency manager feature in access. or at least by having a look at it. you can also link subforms to other subs, and mains to subs by way of setting the link through the interface. can't remember what menu that's in though.
 

Planeman

New member
Local time
Today, 20:40
Joined
Sep 3, 2020
Messages
10
Hi Richard. Welcome to AWF!

I haven't looked at your file, but If you're saying the second subform is linked to the first subform, then one of the most common approach is to use an unbound Textbox on the main form to reference the linking field in the first subform. You would then link the second subform to that Textbox.
Sorry DBguy, I am new to access and not to sure how to do that, would you be able to explain step by step what i need to do

Many Thanks

Richard
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:40
Joined
Oct 29, 2018
Messages
21,358
Sorry DBguy, I am new to access and not to sure how to do that, would you be able to explain step by step what i need to do

Many Thanks

Richard
Let's say the main form has OrderID that you use to link to the first subform showing a list of items ordered, and the first subform has an ItemID that you then use to link the second subform to show the product details for that item.

If so, you would normally have the Master/Child Linked Fields between the main and first subform to use OrderID.

To link the second subform to the first subform, you could add an Unbound Textbox on the main form to display the ItemID from the first subform. The Control Source for that Textbox might look something like this:

Code:
=[SubformControlName].[ItemID]

You would then use that as the link for the second subform, which might look like this:

Master Linked Field: [TextboxName]
Child Linked Field: [ItemID]

Hope that helsp...
 

Planeman

New member
Local time
Today, 20:40
Joined
Sep 3, 2020
Messages
10
Hi Again,

I have tried that, and the text box on the main form says #Name?

I have entered in the text box =[frmIndex] .[URN]

URN is common to both sub-forms....
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:40
Joined
Oct 29, 2018
Messages
21,358
Hi Again,

I have tried that, and the text box on the main form says #Name?

I have entered in the text box =[frmIndex] .[URN]

URN is common to both sub-forms....
Hi. #Name? means you may have misspelled it or it's not the correct name to use. It might be easier if you could share a copy of your db with test data, so we can show you exactly how to do it.
 

Planeman

New member
Local time
Today, 20:40
Joined
Sep 3, 2020
Messages
10
Hi again,

Really sorry to be a pain, i attach a copy of my DB with test data

Regards

Richard
 

Attachments

  • Test Database to replace excel.zip
    38.1 KB · Views: 99

theDBguy

I’m here to help
Staff member
Local time
Today, 13:40
Joined
Oct 29, 2018
Messages
21,358
Hi again,

Really sorry to be a pain, i attach a copy of my DB with test data

Regards

Richard
Hi. Nonsense, you're not being a pain. If anything, I'm the one being a pain. I forgot you already posted your db earlier.

Okay, see if this is what you meant. Hope it helps...
 

Attachments

  • Test Database to replace excel.zip
    27.6 KB · Views: 110

Minty

AWF VIP
Local time
Today, 20:40
Joined
Jul 26, 2013
Messages
10,355
Have a look at the attached .

Edit : DBGuy beat me to it
 

Attachments

  • Test Database Working.zip
    29.6 KB · Views: 96

Planeman

New member
Local time
Today, 20:40
Joined
Sep 3, 2020
Messages
10
Hi Guys,

That is exactly what I Meant !!

I spent hours reading through Access tutorials and experimenting, and still could not get it to do that

Many Thanks for all your time and trouble

Best Regards

Richard
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:40
Joined
Oct 29, 2018
Messages
21,358
Hi Guys,

That is exactly what I Meant !!

I spent hours reading through Access tutorials and experimenting, and still could not get it to do that

Many Thanks for all your time and trouble

Best Regards

Richard
Hi Richard. You're very welcome. We're all happy to assist. Good luck with your project.
 

Planeman

New member
Local time
Today, 20:40
Joined
Sep 3, 2020
Messages
10
Hi Again

I've just had a look at the form in design view, it really was as simple as that !!!!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:40
Joined
Oct 29, 2018
Messages
21,358
Hi Again

I've just had a look at the form in design view, it really was as simple as that !!!!
Correct! No code required. :)

PS. You can even hide the Textbox, if you don't want to show it.
 

Users who are viewing this thread

Top Bottom