Use boolean to filter records

Keith Nichols

Registered User.
Local time
Today, 02:21
Joined
Jan 27, 2006
Messages
431
Hi Folks,

I have a boolean field in my table linked to a check box on my form. What I want to do is hide records that have a tick in the box but I'm having trouble filtering by the check box.

I have tried variations on:

Code:
'Filter archive records
    Me.FilterOn = True
    Me.Filter = [archive]='yes'

But this looks like the wrong way to do it. I'mn thinking that I need to declare a variable and have some if/then test to show or not show a record.

Any ideas?

Regards,

Keith.
 
No.

KenHigg said:
Does it work?
Sorry Ken, No, I can't get it to work which is why I have posted.

Regards,

Keith.
 
Personally I find this whole filter thing a bit cumbersome. I would simple do this limit/filter in the forms underlying query...
 
Of course!

KenHigg said:
this limit/filter in the forms underlying query...

Doh! Ken, you are dead right. It is very easy to drop a 'like yes' or "not like no" on the query. Don't know why I didn't think of it.

My other filters are a toggle to show certain records at certain times so they have to be in the form but the "archive" filter should always be on unless someone requests a bit of history.

Many thanks.

Keith.
 
as a second bit of advice. I think you needed the archive='yes' in quotes, like so:
Me.Filter = "[archive]='yes'" as otherwise the expression would evaluate to either true or false straight away and put 0 or 1 as the forms filter.
 
Thanks Workmad. All these things get absorbed and make it more likely that future problems are resolved before they are posted.

Ken,
The criteria in the query worked fine.

Regards,

Keith.
 

Users who are viewing this thread

Back
Top Bottom