Criteria to include fields with NULL DATA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tasawer
    New Member
    • Aug 2009
    • 106

    Criteria to include fields with NULL DATA

    Hi,

    in the underlying query of a form and to the field 'manu_number', I have added the criteria,
    Code:
     Like "*" & [Forms]![FindCartridge]![cmbManu] & "*"
    this lists all records on startup, except, if manu_number field is blank or null or no data, whence it is excluded.

    how can include fields with no data.
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    Code:
    Like "*" & [Forms]![FindCartridge]![cmbManu] & "*"  Or Is Null

    Comment

    • tasawer
      New Member
      • Aug 2009
      • 106

      #3
      Thanks for your reply.
      This solution brings all records at startup (as I wanted).
      However, once I make a selection in combo box, The Selection + all null values are listed :)

      Comment

      • TheSmileyCoder
        Recognized Expert Moderator Top Contributor
        • Dec 2009
        • 2322

        #4
        Try this
        Code:
        Like "*" & nz([Forms]![frm_Main]![cmb_Test],"") & "*";
        The nz function will check if the first argument is null, and if it is, will return the second argument (""). If it is not null, it will return the first argument.

        That said, im wondering a bit why you even need a "fuzzy" match and using "Like", is there not a primary key you could use instead?

        Comment

        • tasawer
          New Member
          • Aug 2009
          • 106

          #5
          Hi SmileyOne,

          Thanks for the suggetions, you made me smile. :) :) :)

          I used the primary key method.

          my query is a complex one and I was thinking on the same lines, just assuming that this is also a complex solution.

          Thanks

          Comment

          Working...