Results 1 to 4 of 4
  1. #1
    craig1988 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    82

    CrossTab query

    Hi All

    A very simple ask but I have thrawled through tutorials to try and find what I am looking for with no luck.

    I have a table "tblCorrectionLog" that records get input to. Within the table there is a field that must be populated with an ErrorCode. Every record gets a timestamp.

    I would like to build a crosstab query that Shows a scoreboard of the number of corrections logged under their ErrorCode for a particular time period (Between [Forms]... And [Forms]...)

    See below

    Click image for larger version. 

Name:	crosstabexample.PNG 
Views:	10 
Size:	8.3 KB 
ID:	18947

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Readers will need more info if they are to provide focused answers/assistance.

    What are the table(s) or query(ies) involved?
    What have you tried specifically (query sql)?

  3. #3
    craig1988 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    82
    Ill explain a little better. I havent as of yet tried any queries or sql.


    There are 2 tables I believe i need to focus on.

    "tblCorrectionList" - This is a table that contains a list of Corrections. There is currently 15 but this will shrink or grow. Each one has a unique ErrorID.
    "tblCorrectionLog" - This is the table where the corrections are logged. Users use a bound form to add corrections. They enter who commited the error (staffID), the type of error (ErrorID) and it also gets a timestamp (Now()).


    What I want to pull from these tables is a crosstab query. I want the user to input a start date and end date on the form "frmReports" and I want the crosstab query to return;

    The ErrorID's as row headings, The dates (Start date to End date) as Column Headings and the COUNT of each ErrorID on the date.

    So, like my img in the original post, the query will look at each ErrorID and count how many times a correction of that kind was logged for each day within the date span (Start date to end date).

  4. #4
    craig1988 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    82
    Hi again

    So I have tried to experiment myself and have got somewhere but not exactly what I was looking for!!

    I was able to get the correct data for the entire Table "tblCorrectionLog", but I only want records from a certain date period.

    Originally I was basing the crosstab query on the "tblCorrectionLog" so I tried to base it on a query instead (The query pulls records from a specific date period using a form to get the start date and end date Between [Forms]![frmReport]![txtStartDate] And [Forms]![frmReport]![txtEndDate]). This SELECT query is called "qryGrabForCrosstab".

    When I try to run the crosstab query based on "qryGrabForCrosstab" I got a MsgBox telling me "The Microsoft database engine does not recognize '[Forms]![frmReport]![txtStartDate]' as a valid field name or expression".

    What am I doing wrong?? The logic appears to be correct?? Can I enter parameters in my original approach by basing the crosstab directly on the table??

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

Similar Threads

  1. Crosstab Query Help
    By bronson_mech in forum Queries
    Replies: 1
    Last Post: 05-31-2014, 10:12 AM
  2. Replies: 2
    Last Post: 04-30-2014, 03:01 PM
  3. crosstab query help
    By bronson_mech in forum Queries
    Replies: 1
    Last Post: 01-06-2014, 03:09 PM
  4. Replies: 2
    Last Post: 08-16-2013, 01:36 AM
  5. Replies: 1
    Last Post: 07-30-2010, 10:28 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