Link subform with wildcard

G

Guest

I have a main form with a subform.
The sub form and main form are linked
Master: Combo1
Child: [Field1]

If I pick an item in the combo box the subform will only show recods with
matching value in [Field1]

Can I show all records on the subform if the Combobox is NULL or a value
like "All"???

I'd like the user to be show some or all the records.

Thanks in advance,
MM
 
G

Guest

Instead of using the parent child properties link the two forms using the
record source of the sub form

' To match any part of the field
Select * From MyTable Where MyFieldName Like "*" &
Forms![FormName]![ComboName] & "*"

' To match the all field, but return all the values if the combo empty
Select * From MyTable Where MyFieldName Like
nz(Forms![FormName]![ComboName], "*")

============================================
On the after update event of the combo run the code
Me.SubFormName.Requery
============================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top