Run Procedure on Mondays A2007

  • Thread starter Thread starter Bob Quintal
  • Start date Start date
B

Bob Quintal

=?Utf-8?B?VG9tIFZlbnRvdXJpcw==?=
I have an event in the OnOpen event of my spalsh screen which
offers the user a Yes/No option in a message box. User answers
YES, the weekly reports are printed. If user ansers No,
nothing happens. This is working well and running everyday
when the application is opened at start of day.

I am looking for help to set this so that the message box
comes up on Mondays only. I imagine it will be an argument or
evaluation I place at the start of my code which runs the
message box.

Any help?
The weekday() function returns a number from 1 to 7, with sunday
being 1.So
If weekday(date()) = 2 Then
' Ask about running reports
End if.

should be all you need.
 
I have an event in the OnOpen event of my spalsh screen which offers the user
a Yes/No option in a message box. User answers YES, the weekly reports are
printed. If user ansers No, nothing happens. This is working well and running
everyday when the application is opened at start of day.

I am looking for help to set this so that the message box comes up on
Mondays only. I imagine it will be an argument or evaluation I place at the
start of my code which runs the message box.

Any help?
 
I have an event in the OnOpen event of my spalsh screen which offers the user
a Yes/No option in a message box. User answers YES, the weekly reports are
printed. If user ansers No, nothing happens. This is working well and running
everyday when the application is opened at start of day.

I am looking for help to set this so that the message box comes up on
Mondays only. I imagine it will be an argument or evaluation I place at the
start of my code which runs the message box.

Any help?


You currently have your splash screen open using the OnOpen event,
just use an if function to find if it is monday and if it is show your
screen else show another or do nothing
Below From Access Help (Search for "Weekday Function"):

Syntax
Weekday(date, [firstdayofweek])

Returns a Variant (Integer) containing a whole number representing the
day of the week.

Hope this helps
 
Heres abit of code to help, i wanted to try it before i posted it for
you.

Private Sub Form_Open(Cancel As Integer)

' Declare your variable, ive called mine "Weekdays"

Dim Weekdays As Integer

' Use the Weekday function to assign a number to a day.

Weekdays = Weekday(Now, 2)

' Because Above i used (Now,2) Monday has been set as the first
day of the week so as a number it is 1
' So use an IF function to find if the "Weekdays" = 1

If Weekdays = 1 Then

<<<<< Add Your Code Here >>>>>

End If


End Sub
 
Thank you, this did the job.
I also used your code to build similar for the month end procedures.
Example below for interest:

Dim MyDate, MyDay
MyDate = Date
MyDay = day(MyDate)
If MyDay = 28 Then
'all the things to be done.....'
End if
 
Thanks. This works too, with fewer lines.

Bob Quintal said:
=?Utf-8?B?VG9tIFZlbnRvdXJpcw==?=

The weekday() function returns a number from 1 to 7, with sunday
being 1.So
If weekday(date()) = 2 Then
' Ask about running reports
End if.

should be all you need.
 
Back
Top