Filter a subform with a button in Main Form

G

Guest

I am trying to filter a subform by clicking a buton in the main form. Here
are the form and filed names:
Key:
Main form = frmMain
Field in Main Form = POLookup (this is a text string and is the filter
criteria)
Subform = frmSub
Field in Subform = PONo (this is a text string and should be filtered
according the value in POLookup on the main form)

Here is the code for the button called POFilter:

Private Sub POFilter_Click()
Me.frmSub.Form.Filter = "me. frmSub.Form.PONo'" & Me.POLookup & "'"
Me. frmSub.Form.FilterOn = True
Me. frmSub.Form.Refresh
End Sub

Please help me correct my errors. Thank you for your help
 
G

Guest

Correction in my code:
Me.frmSub.Form.Filter = "me. frmSub.Form.PONo ='" & Me.POLookup & "'"
(I forgot to include the equal sign.)
 

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