Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you call a macro from within a Query?

Status
Not open for further replies.

DanSeal

Programmer
Jan 6, 2003
5
GB
Hi,

I have a query that needs to return data from the beginning of the current week, to the end of the current week. I have written some VBA code to work out the relevant dates and attached it to some macros to do this. What I want to do is call the macros from within a query to fill in the relevant dates in the query. Can anyone tell me how to do this?

e.g. SELECT FROM Table WHERE Date Between BeginWeekMacro and EndWeekMacro

Thanks

Danny
 
Why not just call the VBA proceedure directly from the query. Eliminate teh middle man.

 
You can't use macros in queries. However, if your macros are calling VBA modules, you can use the modules directly in your queries.

For example, if you create Public Functions called BeginWeekFunction and EndWeekFunction you can make the query as:

SELECT FROM Table WHERE Date Between BeginWeekFunction() and EndWeekFunction()

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top