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

strWhere when field is Boolean

Status
Not open for further replies.

fishtek

Technical User
Aug 21, 2002
56
US
I would like to use strWhere to search a boolean field. Can someone provide me with the proper syntax?
See similar code below.

Code:
Dim strWhere As String
strWhere = "1=1"
If Not IsNull(Me.chkPaid) Then
strWhere = strWhere & " AND [Paid] Like  """ & Me.chkPaid & """ "
End If
Dim stDocName As String
stDocName = "frmNOVSearch"
DoCmd.OpenForm stDocName, acFormDS, , strWhere

End Sub

Thanks for any help.
 
Like this ?
Code:
If Not IsNull(Me.chkPaid) Then
  strWhere = strWhere & " AND [Paid]=" & IIf(Me.chkPaid, "True", "False")
End If

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
hi,

SEARCH? You can SELECT a boolean field or assign a criteria to a boolean field. I'm assuming that Me.chkPaid is True/False
Code:
Dim strWhere As String
strWhere = "1=1"
If Not IsNull(Me.chkPaid) Then
  strWhere = strWhere & " AND [Paid] = " & Me.chkPaid 
End If


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top