Results 1 to 5 of 5
  1. #1
    cbh35711 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Posts
    40

    Expression too complex to Evaluate

    All,



    I am having a query problem. The query will pull from a form where the user input dates. Below is the date part of the where statement

    Code:
    and RA.PDModifiedDate >="#" & Format(Forms![Reconciliation Report]!Start_date,"mm\/dd\/yyyy") & "#" 
    And RA.PDModifiedDate <="#" & Format(Forms![Reconciliation Report]!End_date,"mm\/dd\/yyyy") & "#"
    This code has worked correctly in previous query. The one i'm using it in now is much more complex.

    Code:
    SELECT a.SystemID, a.PD, a.oid, b.[proposed pd grade]
    FROM FAMAS_bbvaAuditLog AS RA, [Current Log] AS Log, (select systemid, max (OID) as max_oid
    from[FAMAS_bbvaauditlog]  
    group by systemid)  AS max_id
    WHERE a.systemid = b.systemid
    and max_id.systemid = a.systemid
    and max_id.max_oid = a.oid
    and a.PD IN ("CCC+", "CCC", "CCC-", "CC+", "CC", "CC-", "D1", "D2")
    and a.PDStatus = "Approved" 
    and (a.FacilityStatus = "Booked" OR a.FacilityStatus = "Booked-Pending" OR a.FacilityStatus = "Approved")
    and a.LGD is not null
    and a.pd <> b.[proposed pd grade]
    and a.PDModifiedDate >="#" & Format(Forms![Reconciliation Report]!Start_date,"mm\/dd\/yyyy") & "#" 
    And a.PDModifiedDate <="#" & Format(Forms![Reconciliation Report]!End_date,"mm\/dd\/yyyy") & "#"
    GROUP BY a.SystemID, a.PD, a.oid, b.[proposed pd grade];
    It works perfectly, before i add the date range code.

    Your assistance is greatly appreciated.

    Chris

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Why using Format function?
    I would use BETWEEN AND, it is inclusive for the range end dates.

    "a.PDModifiedDate BETWEEN #" & Forms!Reconciliation Report]!Start_date & "# AND #" & Forms![Reconciliation Report]!End_date & "#"
    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.

  3. #3
    cbh35711 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Posts
    40
    June,

    I used format because it was the only way i could it to work with the same one. I appreciate the Between and AND. I will try that. Do you think that is the cause of the error?

    Thanks,

    Chris

  4. #4
    cbh35711 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Posts
    40
    So with a couple tweaks I used BETWEEN and AND for both queries. It worked perfectly in the first query, so I know it's not the date specifically. When i replace it in the second query, it still has the same error.


    Code:
    SELECT a.SystemID, a.PD, a.oid, log.[proposed pd grade]FROM FAMAS AS A, [Current Log] AS Log, (select systemid, max (OID) as max_oid
    from[FAMAS]  
    group by systemid)  AS max_id
    WHERE a.systemid = Log.systemid
    and max_id.systemid = a.systemid
    and max_id.max_oid = a.oid
    and a.PD IN ("CCC+", "CCC", "CCC-", "CC+", "CC", "CC-", "D1", "D2")
    and a.PDStatus = "Approved" 
    and (a.FacilityStatus = "Booked" OR a.FacilityStatus = "Booked-Pending" OR a.FacilityStatus = "Approved")
    and a.LGD is not null
    and a.pd <> log.[proposed pd grade]
    and a.PDModifiedDate BETWEEN "#" & Forms![Reconciliation Report]!Start_date & "#" AND "#" & Forms![Reconciliation Report]!End_date & "#"
    GROUP BY a.SystemID, a.PD, a.oid, log.[proposed pd grade];

    Any help would be appreciated.

    Chris

  5. #5
    cbh35711 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Posts
    40
    June,

    I removed all of the # nonsense and it worked find there after.

    Thanks for your help,

    Chris

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

Similar Threads

  1. Replies: 3
    Last Post: 12-30-2011, 12:43 PM
  2. Evaluate Database Errors
    By billgyrotech in forum Access
    Replies: 2
    Last Post: 08-09-2011, 01:29 PM
  3. Replies: 3
    Last Post: 03-31-2011, 11:07 AM
  4. Evaluate result of sql query
    By Tyork in forum Programming
    Replies: 2
    Last Post: 11-09-2010, 05:41 PM
  5. need help, expression is too complex?
    By ice673 in forum Queries
    Replies: 5
    Last Post: 02-15-2010, 09:03 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