Results 1 to 5 of 5
  1. #1
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287

    Crosstab query acting up..?

    Hey guys,



    I have attached a stripped down version of our bonus program. The "Dots report" has decided to start acting up for some reason.

    This report is every salespersons warranty sales percentage, and conditional formatting color codes it. The user selects the desired quarter on the main form and hits the button. The report is a crosstab with the past weeks being the column heading, which is all pulled from the DOTS table. In that table, you will see that there is data all the way up to 4/13/14 (Date To field in DOTS table). I cannot figure out why the most recent week (week ending 4/13/14) is not showing up in this report (or the crosstab query for that matter).

    It has worked great since inception which was around November last year.

    Also, not sure if this info is needed:
    -VBA prompts the user every Monday if they want to add the last weeks data
    -This code is in the On Load event of the form
    -All data in the DOTS table is in 1 week blocks
    Attached Files Attached Files

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    What are you trying to do with the week calculation in your crosstab? There are all kinds of faulty issues (at least in my view) what date related functions in access.

    For instance if you do a datediff("yyyy", firstdate, seconddate)

    let's say the firstdate is 4/1/2013 and the second date is 2/1/2014 this would be calculated as 1 year even though it's not technically a year because it crosses the 12/31 date.

    So depending on what you're actually trying to get at with this code is where I'd start looking for the problem.

  3. #3
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287
    The week calculation is basically just showing 1 quarter of the year (broken down by weeks) for salespeople's performance. The datediff equation is just to count out the number of weeks. I got most of the code from: http://www.access.hookom.net/Dynamic...rosstabRpt.htm

    The report fills in the weeks, starting from the left, as the quarter goes on. This report is ran every Monday and sent out to the managers. Everything has acted exactly as it should up until this last week which is what is confusing me so much.

    For instance if you do a datediff("yyyy", firstdate, seconddate)

    let's say the firstdate is 4/1/2013 and the second date is 2/1/2014 this would be calculated as 1 year even though it's not technically a year because it crosses the 12/31 date.
    I've read about these issues as well. The way my DOTS table is set up combined with my VBA forcing the dates to be a Sunday thru Monday have pretty much fixed any issues that I could find.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Look at this query

    Code:
    SELECT DOTS.[Date From], DOTS.[Date To], DOTS.SO_STORE_CD, DOTS.Name, DOTS.Pct, DOTS.Covered, DOTS.Total, DOTS.EmpCode, MISC_EMP.TITLE
    FROM DOTS LEFT JOIN MISC_EMP ON DOTS.EmpCode = MISC_EMP.EMP_CD;
    The only criteria in your crosstab is that the TITLE must be "SALES" or "AMGR"

    Note that for the 4/13 ALL of your EMPCODES in your DOTS table are null, which in turn means you will have all null values in your TITLE field so your crosstab isn't pulling any data. In order to capture the null values you'd have to have

    "SALES" or "AMGR" or Is Null as your critiera but this might give you results you don't want either.

  5. #5
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287
    Note that for the 4/13 ALL of your EMPCODES in your DOTS table are null
    That's it. God. How did I not catch that?? Those should be populating from the append query. Easy fix.

    Thank you so much!

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

Similar Threads

  1. Replies: 2
    Last Post: 03-22-2013, 01:57 PM
  2. References acting up on virtual machine
    By theosgood in forum Access
    Replies: 0
    Last Post: 01-31-2013, 10:06 AM
  3. query is acting up
    By kwooten in forum Queries
    Replies: 20
    Last Post: 12-21-2011, 12:50 PM
  4. Update Query acting up
    By compooper in forum Queries
    Replies: 1
    Last Post: 07-04-2011, 12:27 PM
  5. Table/Query acting wierd
    By Rick West in forum Queries
    Replies: 2
    Last Post: 03-10-2010, 10:11 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