Results 1 to 6 of 6
  1. #1
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544

    The query expression is too compliated bla bla bla


    Happy Friday all! I am trying to get a report to display records either between the start and end date entered on the main form, or show all dates. Have done this a thousand times before but now Access wants to get funky (or my brain does). Here's my sql:

    Code:
    SELECT Members.MemberID_PK, Accounts.DBAmount, Accounts.DBDate, Accounts.Details, Accounts.CRAmount, Accounts.CRDATE, Accounts.Comments, Accounts.CheckNumber, Accounts.AsmtType
    FROM Members INNER JOIN Accounts ON Members.MemberID_PK = Accounts.MemberID_FK
    WHERE (((Accounts.DBDate) Between [FORMS]![MEMBERS]![SDATE] And [forms]![members]![edate]) AND ((Accounts.AsmtType) Like "*" & "monthly" & "*")) OR (((Accounts.CRDATE) Between [FORMS]![MEMBERS]![SDATE] And [forms]![members]![edate]) AND ((Accounts.AsmtType) Like "*" & "monthly" & "*"));
    have also tried:
    Code:
    SELECT Members.MemberID_PK, Accounts.DBAmount, Accounts.DBDate, Accounts.Details, Accounts.CRAmount, Accounts.CRDATE, Accounts.Comments, Accounts.CheckNumber, Accounts.AsmtType FROM Members INNER JOIN Accounts ON Members.MemberID_PK = Accounts.MemberID_FK WHERE (((Accounts.DBDate) Between Nz([FORMS]![MEMBERS]![SDATE],#1/1/1900#) And Nz([FORMS]![MEMBERS]![End Date],#1/1/2199#)) AND ((Accounts.AsmtType) Like "*" & "monthly" & "*")) OR (((Accounts.CRDATE) Between Nz([FORMS]![MEMBERS]![SDATE],#1/1/1900#) And Nz([FORMS]![MEMBERS]![End Date],#1/1/2199#)) AND ((Accounts.AsmtType) Like "*" & "monthly" & "*"));


    With or without a date entered I get no results. Running the query by itself gives me the "too complicated" error.

    TIA! ~PEACE~


  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    What results do you get without any WHERE clause
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,130
    Not sure if you re using a query or a SQL statement.
    Try the following

    Code:
    SELECT Members.MemberID_PK, Accounts.DBAmount, Accounts.DBDate, Accounts.Details, Accounts.CRAmount, Accounts.CRDATE, Accounts.Comments, Accounts.CheckNumber, Accounts.AsmtType
    FROM Members INNER JOIN Accounts ON Members.MemberID_PK = Accounts.MemberID_FK
    WHERE (((Accounts.DBDate) Between #" & [FORMS]![MEMBERS]![SDATE] & "# And #" & [forms]![members]![edate]) & "# AND ((Accounts.AsmtType) Like '*monthly*')) OR (((Accounts.CRDATE) Between #" & [FORMS]![MEMBERS]![SDATE] & "# And "# & [forms]![members]![edate] & "#) AND ((Accounts.AsmtType) Like '*monthly*'));
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  4. #4
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Hi Bob!

    No criteria whatsoever, I get all of the account records.

    THANKS!

  5. #5
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Hi Ridders52!

    Getting a syntax error in date Click image for larger version. 

Name:	syntaxerror.JPG 
Views:	10 
Size:	34.1 KB 
ID:	36210

    Thanks!

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,130
    Sorry I was typing on a tablet and made a mistake. Corrected version below with change in RED - hopefully correct this time

    Code:
    SELECT Members.MemberID_PK, Accounts.DBAmount, Accounts.DBDate, Accounts.Details, Accounts.CRAmount, Accounts.CRDATE, Accounts.Comments, Accounts.CheckNumber, Accounts.AsmtTypeFROM Members INNER JOIN Accounts ON Members.MemberID_PK = Accounts.MemberID_FK
    WHERE (((Accounts.DBDate) Between #" & [FORMS]![MEMBERS]![SDATE] & "# And #" & [forms]![members]![edate]) & "# AND ((Accounts.AsmtType) Like '*monthly*')) OR (((Accounts.CRDATE) Between #" & [FORMS]![MEMBERS]![SDATE] & "# And #" & [forms]![members]![edate] & "#) AND ((Accounts.AsmtType) Like '*monthly*'));
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

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

Similar Threads

  1. Replies: 2
    Last Post: 11-16-2017, 03:33 AM
  2. Replies: 4
    Last Post: 05-03-2016, 01:51 PM
  3. Replies: 2
    Last Post: 11-20-2012, 03:21 AM
  4. Replies: 4
    Last Post: 10-26-2012, 12:49 AM
  5. Query Expression Help
    By hmartin in forum Queries
    Replies: 7
    Last Post: 01-21-2012, 11:37 PM

Tags for this Thread

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