Results 1 to 2 of 2
  1. #1
    nggman is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2017
    Posts
    27

    Date variable for access query

    I can use this: Format(DateAdd("m",-1,Date()),"yyyymmdd") in the criteria of my MS Access query and it will subtract one month for me and work. If I use this: Format(DateAdd("m",-1,"StartOfMonth"),"yyyymmdd") to try to get the FIRST of the previous month I get a 'Data type mismatch in criteria expression' error. Does anyone know a fix for that?



    Thank you.

  2. #2
    nggman is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Oct 2017
    Posts
    27
    I found this and it worked!!

    Format(DateSerial(Year(Date()), Month(Date())-1,1),"yyyymmdd")

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

Similar Threads

  1. Date variable in query
    By jctaylor in forum Queries
    Replies: 6
    Last Post: 07-22-2017, 07:49 PM
  2. Replies: 5
    Last Post: 04-27-2015, 02:40 PM
  3. Query with Date Variable
    By robrich22 in forum Queries
    Replies: 1
    Last Post: 02-17-2014, 02:46 PM
  4. Query with Date Variable
    By robrich22 in forum Queries
    Replies: 2
    Last Post: 02-17-2014, 01:03 PM
  5. Replies: 0
    Last Post: 08-10-2011, 11:59 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