Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    513

    simple SQL

    I've got the following query as the data source for a form:
    (I do not want any records where the value of [Rep Agency ] is null to be displayed)...



    Code:
    SELECT tblManufacturers.*
    FROM tblManufacturers
    WHERE (((tblManufacturers.[Rep Agency]) Is Not Null))
    ORDER BY tblManufacturers.[Rep Agency], tblManufacturers.ManufacturerName;

    It seems to me that I've got the query correct. I've even added a simple text box to the form with the data source:
    Code:
    =Nz([rep Agency],"null")
    yet still the records are included; that text box blatantly returns "null" values.

    perplexed, yet with thanks in advance..
    Mark

  2. #2
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    they are probably not null but zero length strings, try chaning your criteria to

    WHERE (((nz(tblManufacturers.[Rep Agency],"")) <>""))

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Try

    WHERE tblManufacturers.[Rep Agency] Is Not Null AND tblManufacturers.[Rep Agency] <> ""
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    When you execute the current query, how many records are returned?

    If you then remove the criteria and execute the query, how many records are returned?


    Text boxes have Control source, not data source.
    For a bound control, the control source should not have the equals sign, just the name of the field the control is bound to.

  5. #5
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    513
    1651 records with the filter
    1724 records without it
    ... so obviously some of the null records were not

    (?) confused then... why was the text box with the control source
    =Nz([rep Agency],"null")

    Showing the value "null" for some of the records, while for others it did show a value that matched the entry in the record?
    I would have expected that any record as such (with a null value) would have been filtered out at the form's recordsource? no?
    for now, let's leave it as a redundant question (and a lesson for tomorrow...)


    Code:
    WHERE (((nz(tblManufacturers.[Rep Agency],"")) <>""))

    WORKED!!! and for that: BIG thanks

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

Similar Threads

  1. Simple Sum qn
    By Davidyam in forum Access
    Replies: 5
    Last Post: 04-18-2012, 04:05 AM
  2. This is a simple one
    By bbrazeau in forum Reports
    Replies: 3
    Last Post: 02-22-2012, 11:34 AM
  3. Hopefully simple If Then
    By fender357 in forum Programming
    Replies: 4
    Last Post: 05-09-2011, 07:52 PM
  4. Replies: 0
    Last Post: 10-21-2010, 08:24 AM
  5. Simple Export Not So Simple
    By jgelpi16 in forum Programming
    Replies: 11
    Last Post: 09-01-2010, 07:23 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