Results 1 to 8 of 8
  1. #1
    67159 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2015
    Location
    SC
    Posts
    8

    Crosstab query needs to display empty cells

    I may not be stating this correctly, but here's my problem. I run a query on demand for a sales promo. I have a table with 73 customer account numbers and names along with the account's salesperson number and name.

    I need the crosstab query to return sales dollars and also display zero or nothing if nothing has been sold to that customer.

    So far all I get is anything with a sale. Does this make sense.

    This is what I'm aiming to get, currently I'm entering all the zeros in the spreadsheet. Help!



    Account Manager Customer Name Total Promo Sales July June May
    Region 05 Totals $6,218.94 $84.24 $4,684.35 $1,450.41
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00
    Salesperson Name Customer Name $126.36 $0.00 $0.00 $126.40
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00
    Salesperson Name Customer Name $97.34 $0.00 $0.00 $97.34
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00
    Salesperson Name Customer Name $90.54 $0.00 $90.54 $0.00
    Salesperson Name Customer Name $591.10 $0.00 $0.00 $591.10
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00
    Salesperson Name Customer Name $131.82 $0.00 $131.82 $0.00
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00
    Salesperson Name Customer Name $384.48 $0.00 $384.48 $0.00
    Salesperson Name Customer Name $275.50 $0.00 $275.50 $0.00
    Salesperson Name Customer Name $1,655.28 $0.00 $1,655.30 $0.00
    Salesperson Name Customer Name $0.00 $0.00 $0.00 $0.00

  2. #2
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    Format the controls - something like

    ;;;"$0.00"

  3. #3
    67159 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Location
    SC
    Posts
    8
    Forgive my ignorance, but I'm not sure what you mean by "controls". I've never used the semicolon in access. What does it mean and do? Thank you for your help. Have a great Friday!

  4. #4
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    controls are used in forms and reports to display your data.

    If you are just using a query then open the properties for the value column (select properties from the ribbon or right click and select properties) - you'll find it there

    format has 4 'states' - positive, negative, zero and text - the last one also applies to null. The first three only apply to numbers. The semi column is used to separate the different states so access knows which state the format is to be applied to.

    so you could format as $0.00;[red]$0.00;;$0.00

    which will show negative values in red and nulls as $0.00

    or something like this

    [Green]$0.00;[red]$0.00;;"nothing found"

    or
    Currency;[Red]Currency;"-","N/A"

    see this link for more information on formatting

    https://msdn.microsoft.com/en-us/lib.../gg251755.aspx

    find the section 'Different Formats for Different Numeric Values (Format Function)' about halfway down

    Although it refers to the format function, the same rules apply for the format property

  5. #5
    67159 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Location
    SC
    Posts
    8
    Ajax,

    Sorry for the delay. Thank you for your response. I learned something new.
    That helps fill in the empty cells where a hit has occurred.
    However, I have a table with 73 customers. The rows with no hits during the given times don't show up at all. Any thoughts?

  6. #6
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    you need another table or query which lists all the salespersons names which you then left join to the crosstab query - then where a salesperson is not in the crosstab, you will get nulls for that salesperson

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Do you want all salespersons or all customers?

    Options:

    1. a dataset of all possible customer and date combinations joined to the sales data then build crosstab

    2. join crosstab to Customers table
    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.

  8. #8
    67159 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Location
    SC
    Posts
    8
    B-E-A-utiful. God bless you, Ajax! Worked perfectly. Now I have all the accounts and their month by month data. Thank you so much.

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

Similar Threads

  1. Replies: 6
    Last Post: 05-07-2014, 11:15 AM
  2. Replies: 1
    Last Post: 04-15-2014, 02:45 PM
  3. Replies: 7
    Last Post: 03-10-2013, 11:29 AM
  4. code to delete rows based of empty cells
    By jcbrackett in forum Programming
    Replies: 3
    Last Post: 03-05-2012, 02:27 PM
  5. Replies: 2
    Last Post: 08-29-2011, 07:16 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