Link subform with wildcard

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
============================================
 
Back
Top