You used the Like operator and wildcard? Also use criteria: Or Is Null
You used the Like operator and wildcard? Also use criteria: Or Is Null
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Yeah, that did the trick =)
But now all my search parameters are LIKE [xxx] & "*" so when I search for nothnig, every post shows. And I want it that way. But some categorys like "computer" and "computer, laptop" is a problem. 'cause when I search for all "computer", also the "computer, laptop" is shown because of the LIKE & "*".
But when I remove LIKE or & "*" the "search-for-nothing-show-all" is lost...
Is there another way?
The alternative is VBA code to build a search criteria string.
The string can be used in the WHERE argument of DoCmd.OpenForm (or OpenReport) or to set Filter property. Simple examples:
With Me
Dim strFilter As String
strFilter = strFilter & IIf(IsNull(.textbox1), "", "fieldname1='" & .textbox1 & "'"
strFilter = strFilter & IIf(IsNull(.textbox2), "", IIf(strFilter = "", "", " AND ") & "fieldname2=" & .textbox2
DoCmd.OpenForm "formname", , , strSQL
End With
OR
Me.ctrSampleList.Form.Filter = strSQL
Me.ctrSampleList.Form.FilterOn = True
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Ooops! Forgot to fix my sample code in previous post and can no longer edit it. Where I have strSQL should be strFilter.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.