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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filters

Status
Not open for further replies.

mrchinchin25

IS-IT--Management
Oct 10, 2002
15
GB
I've got a form called (newguest) which has a subform on it called (guestSingle).

I have quite a few filters on these forms, which are issued via command buttons.

The filter code may be something like:
(on guestSingle for example)
me.filter = "[Guest] is null"
me.filteron = true
(where guest is a field on the subform.)

I switch the filter off by adding me.filterOn = false in a procedure where necessary.

Is there any way of specifying which filter i switch off when using me.filterOn = false????

I'd like to be able to switch off the subform's filter, ready to load a different filter on it, and I'd like to do this without knocking off the filter I will have overall on the main form.

I have been advised to try the following syntax:
Me.MySubformObjectName.Form.FilterOn = True/False

which in my case is
"Me.Single_Room_No.newguest.FilterOn = False"

"Single_Room_No" is the name of the Object (ie. what I'm putting the filter on in the first place, its a textbox)

"newguest" is the name of the main form (Single_Room_No is on the main form not the subform)

An error comes up "Method or Data Member Not Found".

Any ideas?

 
"Is there any way of specifying which filter i switch off when using me.filterOn = false????"

Actually FilterOn = False inatcivates the active filter from the form.

At a certain moment there can be only one [lol] filter in the Filter property of the form and that's the filter you shut off.
To preserve the filter you have, store it into a string variable before applying a new filter:

strOriginalFilter = Me.Filter
Me.Filter = strOriginalFilter & " And [Guest] Is Null"
Me.FilterOn = True

When you want to restore the original filter, just get its value from the variable:

Me.Filter = strOriginalFilter

HTH
[pipe]
Daniel Vlas
Systems Consultant
danvlas@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top