SubForm filter based on a ComboBox

Ste4en

Registered User.
Local time
Today, 17:00
Joined
Sep 19, 2001
Messages
142
I am running into a problem with just one form in my database. I was getting the error 'Can't build a link between unbound forms'. After searching here and elsewhere the solution is/might be to type the linked fields into the child and master proprty fields. However when I do that I still can't get this form to work. Would anybody please take a look at the file attached - I trimmed it down to two tables with a few records and a form/subform.

I want to make a selection in the combo box and have the filtered results displayed on the form below - simple and I have done the same thing in the database elsewhere but I just can't see why it won't work here.

Thanks

Steve
 

Attachments

Not sure about the overall method you're using here but it appears to me that the main does not need to bound to a record source at all if all you want to do is have the sub forms underlying record set filtered by a combobox value. In which case you don't even need a form / subform set up - just put the unbound combo on a mainform and use it to drive the criteria...

On the other hand if you must have the form / subform set up, I'm guessing you need to have the combobox unbound and use it as the criteria for the mainform's underlying query.

Hope this makes sense...
 
Ken I appreciate the help - you are right that I don't really need the subform/ form arrangement. I dont seem to be able to do what I want without it though (or with it!). I want to be able to select the combo value and have the form filtered to just show the related records.

So I am still missing something - I assume after I select the combo value that I need to use the after update property to select the related records - but I don't know how. Is this the right approach and can you guide me further.

thanks
 
In case anyonme else is looking for a solution to the same problem I found this solution on these boards and it was what I was missing.


The way I do this is to base the form on a query. I then add an UNBOUND combobox that will store the ID #. In the query I set the criteria for the ID # to:

=Forms!formname!controlname

where formname is the name of your form and controlname the name of the unbound control.

Finally, in the After Update event of the unbound combo place this line of code:

ME.Requery

to requery the form.
 

Users who are viewing this thread

Back
Top Bottom