Results 1 to 7 of 7
  1. #1
    Jamescdawson is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    South Wales, UK
    Posts
    98

    Looking for code to eliminate Nul results

    I'm looking for a little help on producing a report which excludes NUL results.



    I have Drivers out on the road 6 days/week. I've generated a report which lists each client and which driver attends on which-ever day of the week. (sometimes the clients gets more than one call per week. The drivers name appears in a column in the report under the day of the week he attends the customer. There's a load of customers that don't get a call on any day of the week and I'd like to exclude these records from the report.

    So my report looks like this

    Customer City/Town PostCode Monday Tuesday Wednesday Thursday Friday Sunday
    Brad Pitt Stafford ST19 5PL David
    D Beckham Newport NP22 4TR Mike
    Johhny Depp Blackwood GH78 9YT Garry Peter
    Mike Douglas Bristol BR78 3ER
    Helen Mirren London SW12 5TG Ken


    I want to eliminate all the records which do not have a driver name in any of the day columns. (in my example above, I'd like to remove Mike Douglas from the report.

    Can anyone point me in the right direction. I've tried nested IIFs in a query but I can't make it work - then again, I might not be doing it right.

    If there a slick simple solution ?

    Best Regards to you all

    Jimbo

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Create a field with calculation that tests each of the other fields and apply criteria to this constructed field. One expression could be:

    CheckDays: Nz([Monday],Nz([Tuesday],Nz([Wednesday],Nz([Thursday],Nz([Friday],[Sunday])))))

    No Saturday?

    Criteria would be: Not Is Null

    Assumes no empty strings permitted in fields.
    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
    Jamescdawson is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    South Wales, UK
    Posts
    98
    June7

    I'll give a go. Thanks.

    drivers don't work on Saturday

    I'm fairly new to Access.... Just some guidance on the syntax... Not is Null .. Is this what I put in the criteria in the query ?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Yes, that is the exact criteria.
    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.

  5. #5
    Jamescdawson is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    South Wales, UK
    Posts
    98
    June7,

    I've been trying to maek tyour suggestion work.. No luck...

    This is what I've put in the expression builder....

    CheckDays: Nz([DriverMonday],Nz([DriverTuesday],Nz([DriverWednesday],Nz([DriverThursday],Nz([DriverFriday],[DriverSunday])))))

    Noted that "Nz" missing before Sunday... and only 5 parenthasis at the end ?

    Is this nearer the mark ?

    CheckDays: Nz([DriverMonday],Nz([DriverTuesday],Nz([DriverWednesday],Nz([DriverThursday],Nz([DriverFriday],Nz[DriverSunday]))))))

    BTW: This doesn't work either.... I'm advised that I have a dot or ! where it shouldn't be !

    =Jimbo=

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Parens must be paired. Nz has argument for alternate value. My structure is correct. I did test it. If the first 5 are null, then DriverSunday value should return.

    Your structure should be:
    CheckDays: Nz([DriverMonday],Nz([DriverTuesday],Nz([DriverWednesday],Nz([DriverThursday],Nz([DriverFriday],Nz([DriverSunday],"None"))))))

    Then criteria would be <> "None"

    Neither will work if your table has empty strings in the fields. That will mean a more complex conditional expression.

    Show the complete SQL statement of the query.
    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.

  7. #7
    Jamescdawson is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    South Wales, UK
    Posts
    98
    June7

    Thanks for you assistance. Got it in the end

    Jimbo

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

Similar Threads

  1. Code results in error on the first day of every month
    By boomerang in forum Programming
    Replies: 6
    Last Post: 11-05-2011, 11:29 AM
  2. Can't eliminate Object Dependencies
    By skahle89 in forum Access
    Replies: 1
    Last Post: 12-02-2010, 11:21 AM
  3. Eliminate dead code
    By thekruser in forum Programming
    Replies: 7
    Last Post: 09-15-2010, 09:52 AM
  4. Replies: 4
    Last Post: 01-11-2010, 11:41 PM
  5. Replies: 16
    Last Post: 09-23-2009, 08:47 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