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

I want to run a macro every saturday which in turn runs a query.

Status
Not open for further replies.
Feb 19, 2005
47
0
0
GB
I want to run a macro which in turn runs a macro every saturday. I have the following as a module. it finds the nearest saturday. Would it be possible to amend this code to include a few lines to run the macro only if today is saturday?


Function GetSatDate(CurrentDate)
If VarType(CurrentDate) <> 7 Then
GetSatDate = Null
Else
Select Case Weekday(CurrentDate)
Case 1 ' Sunday
GetSatDate = CurrentDate - 1
Case 2 ' Saturday
GetSatDate = CurrentDate
Case 3 To 7 ' Monday..Friday
GetSatDate = CurrentDate - Weekday(CurrentDate) + 2
End Select
End If
End Function
 
Create the macro, then create a shortcut to the macro by dragging the macro object from the database window to your desktop. Open the Scheduled Tasks folder (Start-All Programs->Accessories->System Tools->Scheduled Tasks)
Drag the new macro shortcut to the task folder. Then double click the new task to set the schedule and other properties.

 
thanks for that! I'll porbably end up using it. Is there any way I can do it within access itself though?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top