Results 1 to 3 of 3
  1. #1
    HS_1 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Posts
    109

    Problem filtering continuous form for empty or null string

    I am having problem filtering continuous form for empty ornull string. Wonder what I am doing wrong here?
    This is what I have so far
    Row Source:
    SELECT DISTINCT tbl_Tracking.EHT_Zone
    FROM tbl_Tracking
    WHERElen(tbl_Tracking.EHT_Zone)>0
    UNION Select "(Blank)"
    FROM tbl_Tracking
    ORDER BY tbl_Tracking.EHT_Zone;
    When Debug.Print strEhtZoneI I see in immediate window


    AND tbl_Tracking.EHT_Zone =((tbl_Tracking.EHT_Zone) Is NullOr (tbl_Tracking.EHT_Zone)="))

    [CODEPrivate Sub cboEhtZone_AfterUpdate()
    On Error GoTo Err_Handler
    If Me.cboEhtZone.Value = "(Blank)" Then
    strEhtZone = " AND tbl_Tracking.EHT_Zone =((tbl_Tracking.EHT_Zone) Is Null Or (tbl_Tracking.EHT_Zone)=""))"

    Else
    If Nz(Me.cboEhtZone, "") <> "" And Me.cboEhtZone <> "(Blank)" Then
    strEhtZone = " AND tbl_Tracking.EHT_Zone = '" & Me.cboEhtZone & "'"
    GetRecordSource
    End If
    End If
    If GetListTotal = 0 Then
    MsgBox "There are no records meeting the selected criteria ", vbExclamation, "No data"
    cmdClearEhtZone_Click
    End If
    Debug.Print strEhtZone
    Exit_Handler:
    Exit Sub
    Err_Handler:
    MsgBox "Error " & Err.Number & " in Report_Open procedure : " & Err.Description
    Resume Exit_Handler

    End Sub][/CODE]

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    The filter criteria is nonsense. Maybe you want

    strEhtZone = " AND tbl_Tracking.EHT_Zone Is Null Or tbl_Tracking.EHT_Zone=''"

    or simpler: " AND Nz(tbl_Tracking.EHT_Zone, '') = ''"

    The string begins with AND so what other filter criteria is there?

    Parentheses are critical when mixing AND and OR operators.
    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.

  3. #3
    HS_1 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2016
    Posts
    109
    Thanks June7 one mor time

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

Similar Threads

  1. Filtering a Continuous Form
    By kdbailey in forum Access
    Replies: 4
    Last Post: 03-29-2017, 10:40 AM
  2. Continuous form not filtering
    By Ruegen in forum Forms
    Replies: 1
    Last Post: 12-18-2013, 05:49 PM
  3. Filtering a continuous form
    By sbrookebounds in forum Forms
    Replies: 10
    Last Post: 08-14-2012, 09:56 AM
  4. NULL vs. Empty String
    By obiron in forum Access
    Replies: 3
    Last Post: 08-02-2011, 08:43 AM
  5. Filtering a Continuous Form
    By sbrookebounds in forum Forms
    Replies: 5
    Last Post: 12-14-2010, 11:41 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