Yes/No Fields

Dave Eyley

Registered User.
Local time
Today, 18:54
Joined
Sep 5, 2002
Messages
254
I am building a search string called PropSearchstr which is used as a filter for a subform.
I have used this to filter by PropertyName, Status etc but I want to add a search field for a Yes/No field.

The short routine in the AFTERUPDATE property for the Combo which selects either Yes or No is -


If Not IsNull(Me!Leased) Then
PropSearchstr = PropSearchstr & " AND [Leased]= " & Me!Leased
Forms![PropertySpaceSearch]![PropertyList].Form.Filter = PropSearchstr
Forms![PropertySpaceSearch]![PropertyList].Form.FilterOn = True
DoCmd.Requery ("PropertyList")
End If


I'm missing some important point here and need some help if available.

Thanks

Dave E
 
not sure if any objects in that code are a yes/no field, but refer to the values of a yes/no field in code as True / False

eg

Code:
If Me.YesNo = True Then
    MsgBox "Yes"
Else
    MsgBox "No"
End If
 
Hi wh00t,

It should be so simple - I have this Yes/No field called 'Leased' and I need to search on it as part of a string search. But when I put in the code like -

Searchstr= "[Leased]= " & Me!Leased

and apply it as a filter, it doesn't work.

Yes/No fields aren't the same as text fields or numeric fields, it seems. Hence the problem.

Dave E
 
try something like

If Me.Leased = True OR Me.Leased = False Then
PropSearchstr = PropSearchstr & " AND [Leased]= " & Me!Leased
Forms![PropertySpaceSearch]![PropertyList].Form.Filter = PropSearchstr
Forms![PropertySpaceSearch]![PropertyList].Form.FilterOn = True
DoCmd.Requery ("PropertyList")
End If
 
Thanks Wh00t,

I did get it to work in the end, but I'm still not sure how. I tried so many things for so long.

It was something to do with the Format property and the Combos I was using to select the Yes/No option for the search criteria.

Anyway, that's another problem done. On to the next one!

Thanks again.

Dave E
 

Users who are viewing this thread

Back
Top Bottom