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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating macro to run query only on saturdays

Status
Not open for further replies.
Feb 19, 2005
47
GB
Hello.

I want to create an autoexec macro which will check if today is saturday each time the system is opened. If today is saturday, then I want it to run a query(qryLowStockLevels).

However, I do not know how to refer to the date? I understand that dates are stored as mnumbers i.e. 578932, and are formatted to display the date.

If this is the case (please correct me if I am wrong as I am relatively new to access), how could I create a macro that would check if today is saturday? Thanks!
 
A starting point (VBA):
If Weekday(Date, vbSunday) = vbSaturday Then
DoCmd.OpenQuery "qryLowStockLevels"
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV

Thank you for your help. Would this piece of coding run the query each saturday? and how would I set it as an auto exec? or does this go in the condition of a macro?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top