Results 1 to 2 of 2
  1. #1
    whojstall11 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2011
    Posts
    57

    Query all Data


    I have a search form that filters data by using combo boxes from a query. It works perfect but when you enter in specific criteria, that value comes up and ALL Null criteria too. I only want null seen when form has no criteria in the comboboxes.
    Code:
    Like [Forms]![frmHardwareUpdateSearch]![DeviceType] & "*" Or Is Null
    this is what one of the fields looks like in my query

  2. #2
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Code:
    Dim strQuery As String
    
    strQuery = "SELECT * FROM MyTable WHERE "
    
    If Len([Forms]![frmHardwareUpdateSearch]![DeviceType] & vbNullString) = 0 Then
      strQuery = strQuery & "[DeviceType] Is Null"
    Else
      strQuery = strQuery & "[DeviceType] Like '" & [Forms]![frmHardwareUpdateSearch]![DeviceType] & "*'"
    End If

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 34
    Last Post: 02-15-2012, 05:17 AM
  2. Replies: 13
    Last Post: 10-26-2011, 03:49 AM
  3. Replies: 5
    Last Post: 10-06-2011, 05:49 PM
  4. Replies: 2
    Last Post: 01-31-2011, 08:31 AM
  5. UnMatched Data Query (Edit Data)
    By pedraza4 in forum Queries
    Replies: 3
    Last Post: 06-16-2010, 07:29 AM

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