Results 1 to 5 of 5
  1. #1
    AmanKaur123 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    47

    Runtime error 3070

    Hi Guys



    I have written a crosstab query which is ;linked to a report . The query in itself runs fine without any issues but when I try to run the report then following error comes up:
    "Microsoft Access database engine doesn't recognize " as a valid field name or expression"

    I have defined the parameters in the query as well but this error is really annoying me. Please see below my query:
    Code:
    PARAMETERS Forms!frmreport!txtDateStart DateTime, Forms!frmreport!txtDateEnd DateTime;
    TRANSFORM Count(qryCallAudits_MCMA.AuditID) AS CountOfAuditID
    SELECT qryCallAudits_MCMA.[Staff Name], Count(qryCallAudits_MCMA.AuditID) AS [Total Of AuditID]
    FROM qryCallAudits_MCMA
    WHERE (((qryCallAudits_MCMA.[Date of Observation])>=[forms]![frmreport]![txtDateStart] And (qryCallAudits_MCMA.[Date of Observation])<=[forms]![frmReport]![txtDateEnd]))
    GROUP BY qryCallAudits_MCMA.[Staff Name]
    PIVOT qryCallAudits_MCMA.OutcomeID;
    Any help will be much appreciated. Thanks.

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    reports on crosstabs can fail due to missing fields.
    Does the query run correctly alone as a query?

    IF the query runs fine, then you must build a report that has EVERY possible outcome the query can produce.
    I suggest a 'report table' that has all these fields, append crosstab data to it THEN report on this table.

  3. #3
    AmanKaur123 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    47
    Ranman, The query runs perfectly on its own. Please see below the query which runs fine but as soon as I add AuditorID field in the query then it starts giving hat error message:
    Query without AuditorID field:
    Code:
    PARAMETERS [Forms]![frmreport]![txtDateStart] DateTime, [Forms]![frmreport]![txtDateEnd] DateTime, [Forms]![frmreport]![lststaff] Long;
    TRANSFORM Count(qryCallAuditReport_New.AuditID) AS CountOfAuditID
    SELECT qryCallAuditReport_New.[Staff Name], qryCallAuditReport_New.StandardType, Count(qryCallAuditReport_New.AuditID) AS [Total Of AuditID]
    FROM qryCallAuditReport_New
    WHERE (((qryCallAuditReport_New.[Date of Observation])>=[forms]![frmreport]![txtDateStart] And (qryCallAuditReport_New.[Date of Observation])<=[forms]![frmReport]![txtDateEnd]))
    GROUP BY qryCallAuditReport_New.[Staff Name], qryCallAuditReport_New.StandardType
    PIVOT qryCallAuditReport_New.Score;
    Query with Auditor ID field:
    Code:
    PARAMETERS [Forms]![frmreport]![txtDateStart] DateTime, [Forms]![frmreport]![txtDateEnd] DateTime, [Forms]![frmreport]![lststaff] Long;
    TRANSFORM Count(qryCallAuditReport_New.AuditID) AS CountOfAuditID
    SELECT qryCallAuditReport_New.[Staff Name], qryCallAuditReport_New.StandardType, Count(qryCallAuditReport_New.AuditID) AS [Total Of AuditID]
    FROM qryCallAuditReport_New
    WHERE (((qryCallAuditReport_New.[Date of Observation])>=[forms]![frmreport]![txtDateStart] And (qryCallAuditReport_New.[Date of Observation])<=[forms]![frmReport]![txtDateEnd]) AND ((qryCallAuditReport_New.AuditorID)=[forms]![frmReport]![lstStaff]))
    GROUP BY qryCallAuditReport_New.[Staff Name], qryCallAuditReport_New.StandardType
    PIVOT qryCallAuditReport_New.Score;

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    runs fine but as soon as I add AuditorID field in the query then it starts giving hat error message
    That is your problem then, isn't it? Do as Ranman says - make a report table from the query and use that for your report.

  5. #5
    AmanKaur123 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    47
    Quote Originally Posted by ranman256 View Post
    reports on crosstabs can fail due to missing fields.

    I suggest a 'report table' that has all these fields, append crosstab data to it THEN report on this table.
    Hi Ranman, Could you please help me how to get this done? I have never done it before. Please see below the query. It runs fine for few Staff members when the Score field gives all the result i.e (0,1,2,3)

    But for the Staff member whose scoring suppose doesn't include 1 , it throws the error message.

    If any of the score is missing the error comes up. Any help will be much appreciated.
    Code:
    PARAMETERS [forms]![frmreport]![lstStaff] Long, [forms]![frmreport]![txtDateStart] DateTime, [forms]![frmreport]![txtDateEnd] DateTime;
    TRANSFORM Count(qryCallAudit_Staff.AuditID) AS CountOfAuditID
    SELECT qryCallAudit_Staff.StandardType, qryCallAudit_Staff.[Call Type], qryCallAudit_Staff.SignOffType
    FROM qryCallAudit_Staff
    WHERE (((qryCallAudit_Staff.[Date of Observation])>=[forms]![frmreport]![txtDateStart] And (qryCallAudit_Staff.[Date of Observation])<=[forms]![frmreport]![txtDateEnd]) AND ((qryCallAudit_Staff.[Staff Number])=[forms]![frmreport]![lstStaff]))
    GROUP BY qryCallAudit_Staff.StandardType, qryCallAudit_Staff.[Call Type], qryCallAudit_Staff.SignOffType, qryCallAudit_Staff.[Date of Observation], qryCallAudit_Staff.[Staff Number]
    PIVOT qryCallAudit_Staff.Score;

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

Similar Threads

  1. Replies: 1
    Last Post: 02-04-2015, 03:53 PM
  2. Open form to specific record, error 3070
    By msleelee in forum Access
    Replies: 3
    Last Post: 02-17-2013, 03:05 PM
  3. Error 3070 when running report
    By jlk in forum Reports
    Replies: 3
    Last Post: 02-04-2013, 02:47 PM
  4. Getting error code 3070 for combo box
    By lycialive in forum Forms
    Replies: 9
    Last Post: 12-26-2012, 01:21 PM
  5. Error 3070 When Navigating to a Record
    By Epidural in forum Access
    Replies: 1
    Last Post: 05-10-2012, 09:14 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