Help with a date expression??

  • Thread starter Thread starter Begonia
  • Start date Start date
B

Begonia

Guest
I have a query which returns a number of fields, one of which is a date, format dd/mm/yyyy, and another an integer number (less than 12).

I want to build an expression for another column in the query which takes the date, subtracts the number of months represented by the integer, and returns the last day of the month prior to that result (in the same date format as before), but the expression I'm building is apparently too complex to be evaluated.

Can anyone help me?
 
Try this expression:

CreatedDate: DateSerial(Year(DateAdd("m",-[Enter Month Amount],[YourDateField])),Month(DateAdd("m",-[Enter Month Amount],[YourDateField])),1)-1

Make sure that you go into the query parameters and add "Enter Month Amount" as an Integer.

GumbyD
 
Gumby, thank you. That's the most comprehensive answer I could possibly have hoped for.

Thanks to you also Pat for taking the time to reply.

:)
 

Users who are viewing this thread

Back
Top Bottom