Me.Filter not picking up subform filter

tmort

Registered User.
Local time
Today, 23:31
Joined
Oct 11, 2002
Messages
92
I'm trying to get the filter by form filter from a form/subrorm and use it in a query.

I'm using the general form:

Code:
dim genSql,qd as dao.querydef, as string

genSql="select * from tablename"     

qd=currentdb.querydef("nameOfQuery")  

qd.sql=genSql & " where " & me.filter

docmd.openquery "nameOfQuery"

I'm finding that in looking at the querydef that it is only picking up the filter values from the main form and not the subform.

I may be mistaken, but, I thought it was working earlier today. I have done a few things, but, I can't think of anything I might have done to affect this.

Any ideas?
 
Me.Filter only looks at the form where the code is on. If you want the subform filter then you would have to use

Me.YourSubformControlNameHere.Form.Filter

(where YourSubformControlNameHere means the name of the control on the parent form which HOUSES the subform and NOT the name of the subform itself unless they share the exact same name)
 

Users who are viewing this thread

Back
Top Bottom