Filtername question (1 Viewer)

David44Coder

Member
Local time
Tomorrow, 03:04
Joined
May 20, 2022
Messages
109
I beg indulgence as I try and ask about something I don’t quite follow.
It concerns the FilterName passed via Docmd.OpenForm

The Filtername here is a just-constructed Query at run time. The forms recordsource is a different (permanent) query.
The Form opens showing all the fields in its record source, NOT all the fields in filtername query.

And only those records that match the Where Clause in the filtername query.
So I changed the filter query to just Select * from Table Where.... x= y and find this works exactly the same as before the change
So the Form uses the field specified in the Where clause Filter ? Is this correct?

I may be confusing Filtername with Record Source. What should Filtername be? A query where only a part of it is used ?
I did try the Where syntax that might be used in e.g. FindFirst or DLookup but that didn't work.
If I open the Form directly it shows a completely different set of data (which matches it Property Sheet)
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:04
Joined
Oct 29, 2018
Messages
21,358
Hi. Very good question. I am not 100% sure, but I think all FilterName does is use the WHERE clause in that query against your Form's RecordSource.
 

David44Coder

Member
Local time
Tomorrow, 03:04
Joined
May 20, 2022
Messages
109
Thanks for clearing that up dbGuy.
June I'd never used either Filtername or Where before and it looks like Where is all that's required.
I changed to that and got it working.
 

Users who are viewing this thread

Top Bottom