Getting Subform to act based on Form Combo Box

pbassett

Active Member
Joined
May 5, 2004
Messages
358
My Form has a Combo Box, and I would like the Subform to display only those table rows (e.g. only 10 of 400) which have an ID equal to the ID selected in the Form's Combo Box.
I thought this would be simple but all I currently have is the subform displaying all 400 of the table records, and of course the combo box listing the IDs. I get an error trying to link the Master and Child fields, and my Combo Box says Unbound. I think it has to be Bound.

Thanks,
Pete
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Thanks Denis,

I have only 1 combo box, so using yoru example in the link, I created a macro

Private Sub cmbPIW_AfterUpdate()
[EventID] = [cmbPIW].Column(0)
End Sub

but when I select from my combo box, I get an error
"Run-time error '2465'
Microsoft Access can't find the field '|' referred to in your expression."

Not sure what that means!

Any help is most appreciated. Currently my Link fields (Master and Child) are set to PIW for the 2 subforms. From your link posting I assume I need them changed to EventID.

Pete
 
Upvote 0
Pete, could you send us a bit more info? I can tell you some general stuff now but could be more helpful if I know a bit more about your setup.
1. What is the key field for the subform?
2. Does the SQL statement for your Combo contain that field as the bound field (usually the first field in the query)?
3. Is the Combo unbound (ie not directly connected to a data field; the Control Source should be blank)?
4. Is the main form also unbound (it shouldn't be based on a table or query either).
5. Finally, the text box should also be unbound. The subform must be based on a table (or, better, a query).

Denis
 
Upvote 0
Thanks,

In the past hour, I have got it working to the point of when I select from the Combo Box, the 2 subforms filter so that only records from the PIW are displayed.

Now my problem is that the subform records are read-only. I can't locate the Property to fix this. Do I edit each displayed field's Properties?

Thanks,
Pete
 
Upvote 0
Oops - my RecordSource was a query which precludes me from editing the cells. Now I'm using a Table as RecordSource and can edit cells.

Pete
 
Upvote 0
Just a general comment.

Isn't it great when you figure it out yourself?
Doesn't matter how long you have to plug away, you've now learned this particular trick better than if you'd had somebody clicking away at your database "over your shoulder"

Mike
 
Upvote 0

Forum statistics

Threads
1,221,777
Messages
6,161,871
Members
451,727
Latest member
tyedye4

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top