Thread: Last Date in Criteria
05-10-06, 16:55 #1Registered User
- Join Date
- May 2006
Unanswered: Last Date in Criteria
I have a table with transactions that have dates going back years. I am trying to query using the last transaction date in the table and go back 30 days from it and pull the data. I know that >Days()-30 pulls the last 30 days from today's date. However, I do not need the last 30 days of data from today's date, but from the last transaction date in the table. Is there a way to enter in the criteria to do this? I know you can manually enter in the last date, but I have multiple queries showing different date parameters (last 30, 60, 90 days and so on) and do not want to manually change the last date in the criteria. This is probably a newbie question, but I'm just stumped. Thanks.
05-10-06, 17:06 #2Cavalier King Charles
- Join Date
- Dec 2002
- Préverenges, Switzerland
gives you the max date.
given that Dxxxx() is criticised for being slow, if you plan to run queries on the same client for -30, -60, -90 for a given DMax it might be worth saving the return in a var for the subsequent queries.
one-off: it's not worth it.
then you 'cheat' with your Dmax("yourDateField", "YourTable") - 30
of you use the officially sanctioned dateadd()
they both work tho
izycurrently using SS 2008R2