Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    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.

  2. #17
    PoorCadaver is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Oct 2011
    Posts
    68
    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?

  3. #18
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    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.

  4. #19
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    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.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 11-16-2011, 01:22 PM
  2. Search Form
    By roger556 in forum Forms
    Replies: 5
    Last Post: 07-16-2011, 02:11 PM
  3. Replies: 9
    Last Post: 02-15-2011, 03:05 PM
  4. Search on in a form
    By newtoAccess in forum Access
    Replies: 2
    Last Post: 12-08-2010, 11:28 AM
  5. Search Form VBA
    By rcdugge in forum Programming
    Replies: 2
    Last Post: 07-20-2010, 02:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums