If statement based on the Weekday function

M

Mario

I need to insert this code in a form "on open property":

If today's date is Saturday then
make "this button" visible
End If
 
A

Al Camp

Mario,
First, using the on open will cause the code to execute only once, so as you move from
record to record, the button will show/hide only once.
Use the form's Current event to check the date status each time you access a record,
and show/hide the button accordingly.

Also, if you are enetering the date value that keys the show/hide, you'll need to put
the same code in the AfterUpdate event of that date field.

See WeekDay Function in Help... (use your own fieldnames)

YourButtonName.Visible = WeekDay(YourDateFieldName) = 7
 
M

Mario

Thank you Al, it worked!

Al Camp said:
Mario,
First, using the on open will cause the code to execute only once, so as you move from
record to record, the button will show/hide only once.
Use the form's Current event to check the date status each time you access a record,
and show/hide the button accordingly.

Also, if you are enetering the date value that keys the show/hide, you'll need to put
the same code in the AfterUpdate event of that date field.

See WeekDay Function in Help... (use your own fieldnames)

YourButtonName.Visible = WeekDay(YourDateFieldName) = 7

--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
Top