Results 1 to 8 of 8
  1. #1
    danaspps is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2020
    Posts
    14

    Compile error. In query expression ‘Format([Sale Date],”mmm”’.


    I have been using this database for several years. I created a query (actually one for each of the last 4 years and one for all 4 years combined), then based a report on each query. Everything has been working just fine. Then all of a sudden I go to open one of the reports and get this error: Compile error. In query expression ‘Format([Sale Date],”mmm”’.
    It has been a long time since I made this database and I am very rusty. As far as I know I have changed nothing in the underlying tables. I have attached a screen shot of the table design, query design and an old copy of the report from an old backup. Any help would be greatly appreciated.Click image for larger version. 

Name:	query.jpg 
Views:	13 
Size:	139.0 KB 
ID:	49017Click image for larger version. 

Name:	table design.jpg 
Views:	12 
Size:	128.2 KB 
ID:	49018Click image for larger version. 

Name:	report.jpg 
Views:	12 
Size:	126.3 KB 
ID:	49019

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Is there a possibility of a Null sale date?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,927
    I cannot spot anything obvious.

    I tried with my data and this worked fine, which appears to be the same as your crosstab?

    Code:
    TRANSFORM Sum(Transactions.[Amount]) AS SumOfAmount
    SELECT Transactions.[Description], Sum(Transactions.[Amount]) AS [Total Of Amount]
    FROM Transactions
    GROUP BY Transactions.[Description]
    PIVOT Format([TransactionDate],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
    Attached Thumbnails Attached Thumbnails crosstab.PNG  
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    danaspps is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2020
    Posts
    14
    What is a Null sale date?

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Quote Originally Posted by danaspps View Post
    What is a Null sale date?
    Empty, no date.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    danaspps is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2020
    Posts
    14
    No, every sale has a date. It is like the database just stopped recognizing the date formats. Except in the Property sheet, under column headings, it shows the months. "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","S ep","Oct","Nov","Dec" so it is recognizing something.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you attach the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    danaspps is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2020
    Posts
    14
    I certainly thank you for your time and I have no explanation whatsoever, but it is working now.

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

Similar Threads

  1. Replies: 4
    Last Post: 10-15-2020, 10:13 AM
  2. Compile error in query expression.
    By Standtruec in forum Access
    Replies: 1
    Last Post: 04-29-2016, 09:34 PM
  3. Date format and expression
    By cenibyte in forum Queries
    Replies: 8
    Last Post: 04-11-2016, 11:32 AM
  4. Compile error in Query Expression - Help
    By vad77 in forum Queries
    Replies: 6
    Last Post: 10-29-2015, 03:05 PM
  5. Error in query expression Date()
    By boywonder in forum Queries
    Replies: 15
    Last Post: 12-26-2010, 06:04 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