Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

docmd.ApplyFilter not having any effect

Status
Not open for further replies.

bhujanga

Programmer
Oct 18, 2007
181
US
I have a parent form called "PO Header"
I have a child form called "PO Details"
The parent for just contains the fields: "PO Number", "Vendor" and "PO Date"
The child form's data is a query based on a procurement table. It pulls all records for procurements that have not yet been received. Several fields are listed, among them them is "Vendor".
Once the header information is entered for a new PO, I want to click a button that filters the detail records to only those where the vendor equals the vendor specified in the header.
Hence:
DoCmd.ApplyFilter , "[Vendor] = '" & Forms![PO Header]![Vendor] & "'"
The button that this command is attached to is in the Details form.
I get no error message, but nothing happens. I've used similar syntax successfully in other cases. Any ideas as to why it's not working.
Thanks.
 
Try

Code:
dim strFilter as string
strFilter =  "[Vendor] = '" & me.parent.Vendor & "'"
'verify that it looks good
debug.print strFilter
me.filter = strFilter
me.filterOn = true

if this does not work post the debug output.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top