Results 1 to 3 of 3
  1. #1
    Inspirz is offline Novice
    Windows 10 Access 2007
    Join Date
    Oct 2019
    Posts
    4

    Access DB Pass through query not working

    Hi,I created a pass through query in Access (please see below query #1) and I get a failure "Data Type "m" does not match a defined Type name." I'm creating a pass through because the Tetadata view that has this information has millions of rows and I just need a rolling three months. When I create a direct link query and then select query off of that, it works, (please see query #2 below) but it won't work if I create a pass through query.
    Could someone please let me know why it's failing? I'm
    query #1SELECT PlanCapacityId, PlantName, DeprecatedPlantName, PlanId,
    TimePeriodId, CapacityCode, SystemName, ModuleName, PETROCapacityDescription,
    RowrhsMin, RowrhsMax, Used, LimitCost, StartDateTime, EndDateTime,
    CaseName, BaseCase, NAME, PlanType, EffectiveStartDate, EffectiveEndDate
    FROM SCM_REFINERY_FUNCTIONAL_VW_P.vwLPPlanCapacityDetai l
    where plantname = 'ESE' and startdatetime between (DateAdd("m",-3,Date())) And Date()))

    query #2SELECT [PETRO Capacity Detail].PlanCapacityId, [PETRO Capacity Detail].PlantName, [PETRO Capacity Detail].DeprecatedPlantName, [PETRO Capacity Detail].PlanId, [PETRO Capacity Detail].TimePeriodId, [PETRO Capacity Detail].CapacityCode, [PETRO Capacity Detail].SystemName, [PETRO Capacity Detail].ModuleName, [PETRO Capacity Detail].PETROCapacityDescription, [PETRO Capacity Detail].RowrhsMin, [PETRO Capacity Detail].RowrhsMax, [PETRO Capacity Detail].Used, [PETRO Capacity Detail].LimitCost, [PETRO Capacity Detail].StartDateTime, [PETRO Capacity Detail].EndDateTime, [PETRO Capacity Detail].CaseName, [PETRO Capacity Detail].BaseCase, [PETRO Capacity Detail].NAME, [PETRO Capacity Detail].PlanType, [PETRO Capacity Detail].EffectiveStartDate, [PETRO Capacity Detail].EffectiveEndDate
    FROM [PETRO Capacity Detail]
    GROUP BY [PETRO Capacity Detail].PlanCapacityId, [PETRO Capacity Detail].PlantName, [PETRO Capacity Detail].DeprecatedPlantName, [PETRO Capacity Detail].PlanId, [PETRO Capacity Detail].TimePeriodId, [PETRO Capacity Detail].CapacityCode, [PETRO Capacity Detail].SystemName, [PETRO Capacity Detail].ModuleName, [PETRO Capacity Detail].PETROCapacityDescription, [PETRO Capacity Detail].RowrhsMin, [PETRO Capacity Detail].RowrhsMax, [PETRO Capacity Detail].Used, [PETRO Capacity Detail].LimitCost, [PETRO Capacity Detail].StartDateTime, [PETRO Capacity Detail].EndDateTime, [PETRO Capacity Detail].CaseName, [PETRO Capacity Detail].BaseCase, [PETRO Capacity Detail].NAME, [PETRO Capacity Detail].PlanType, [PETRO Capacity Detail].EffectiveStartDate, [PETRO Capacity Detail].EffectiveEndDate
    HAVING ((([PETRO Capacity Detail].PlantName)="ESE") AND (([PETRO Capacity Detail].StartDateTime) Between (DateAdd("m",-3,Date())) And Date()))
    ORDER BY [PETRO Capacity Detail].StartDateTime DESC;



  2. #2
    Inspirz is offline Novice
    Windows 10 Access 2007
    Join Date
    Oct 2019
    Posts
    4
    i got it... I googled it. I needed to add interval.

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    I suspect it's because you are using access sql, you need to use the sql for the target rdbms (e.g. Teradata). Suggest look at your date fields and functions and compare with the Teradata equivalents

    You also have field names like 'NAME' which is a reserved word - at the very least you should put it into square brackets

    not sure why you are grouping in the second query since you are not using aggregation - suggest use SELECT DISTINCT instead.

    recommend in the future you use code tags to highlight your code - it's pretty unreadable.

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

Similar Threads

  1. Replies: 1
    Last Post: 03-23-2017, 06:16 AM
  2. Replies: 5
    Last Post: 04-27-2015, 02:40 PM
  3. Replies: 7
    Last Post: 03-11-2015, 12:48 PM
  4. Pass Parameters to Access Query from VB.net
    By kbsudhir in forum Access
    Replies: 1
    Last Post: 11-20-2013, 03:07 PM
  5. Replies: 1
    Last Post: 02-08-2012, 04:58 PM

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