hide command button

meenctg

Learn24bd
Local time
Today, 17:46
Joined
May 8, 2012
Messages
133
i have a command button in my form. it has a macro on click event for another form open. the command button usges 1 time for 1 day. so i wanna after one time click it will be hide from my form for today. it will show on my form nxt day. is it possible?
 
What is the function of the button? Is the database opened and closed multiple times a day?
 
The code to hide the button is quite straight forward something along the lines of;
Code:
Me.AnyotherControlOnYourForm.SetFocus
Me.YourButton.Visible = False
DoCmd.RunSQL "UPDATE TBL_DateRec SET TBL_DateRec.DateRun = Date();"
You will need to add a table TBL_DateRec with one field DateRun (to keep track of when the command is run), then in the On Load Event of your Form put;
Code:
If DLookUp("DateRun","TBL_DateRec") <> Date() Then
Me.YourButton.Visible = True
 

Users who are viewing this thread

Back
Top Bottom