-
I have a program that I want to run only once a day. I want the user only to be allowed hit the command button once. Then at 5 oclock the next day I want the button to be enabled again. Does anyone have any ideas on how to approach. I know that I need a timer event but I have no idea on how to disable the command button until the next day.
Any help is greatly appreciated.
Thanks
JK
-
<?>
Code:
Private Sub Timer1_Timer()
Dim myTime As String
myTime = Format(Now, "HH:MM:SS: AMPM")
If myTime = "05:00:00 PM" Then cmdWhat.Enabled = True
End Sub
-
And make sure to disable the command button after it's clicked.
Code:
Public Sub Command1_Click()
Command1.Enabled = False
'Do other stuff here.
End Sub
GL,
D!m
-
Save the data of pressing the button either in a file or in the registry, on run of the prog, check if CurrentData - OldDate > 1 day (or 24 hours)
-
Thanks a lot guys
Have a good weekend
JK
-
You to matey, that's what ya wanted?
-
<?>
jop
you would still need a timer
If you start the pgm at 4:58 the button is disabled
(assuming it is always disabled from load)
at 5:00,6,7,etc, the button will still be disabled.
If, however, kanejone starts the program once a day and just wants the button enabled after 5:00 pm each day, then your method is the way to go as it doesn't include a timer with it's duty on the processor.
Either way...the answer is there. :D