Use a function in a query?

E

EManning

Using A2K. Can I use a function in a stored query? I need to list all
accounting transactions from 07/01/xx thru Date() where xx may be the same
year as Date() or it may be a year earlier, depending on Date().

I create the query currently in a report using a querydef but was wanting to
move it to a stored query if possible.

Thanks for any help or advice.
 
J

John Vinson

Using A2K. Can I use a function in a stored query? I need to list all
accounting transactions from 07/01/xx thru Date() where xx may be the same
year as Date() or it may be a year earlier, depending on Date().

I create the query currently in a report using a querydef but was wanting to
move it to a stored query if possible.

Thanks for any help or advice.

Certainly. Could you explain how you determine the value of xx?

GUESSING here - if you have a July to July fiscal year and you want to
list all transactions in the current FY, use a criterion of

BETWEEN DateSerial(Year(Date()) - IIF(Month(Date()) < 7, 1, 0), 7, 1)
AND Date()
 
E

EManning

Thank you, that works great. Actually I created my own function and was
thinking I would have to call that in the stored query. However what you
suggested is better.
 
Top