Lock a form during a timeperiod?

Vallan

Registered User.
Local time
Today, 15:24
Joined
Jan 16, 2008
Messages
46
Hello.

I just want to ask if this is possible.

I have made a foodordering system, wich mean that people can order their food thru a form.

The latest ordertime is 09.00.

So my question is if it's possible to lock a form during a timeperiod?

Lets say that the form is locked between 09.00 -11.00. (During this time you cant get to the ordering form, just getting a message "Its to late to order on todays date, welcome back tomorrow for new orders)

If this is possible can anyone give me a hint how to do?

Kind regards

Mattias
 
If you put a warning in the Form_Load event, it has the strange habit of popping up the warning before the form itself appears. What I'd do is have the warning pop up if the user tries to enter/alter a meal within your time frame:

Code:
Private Sub Form_Dirty(Cancel As Integer)
If Time() > #9:00:00 AM# And Time() < #11:00:00 AM# Then
 Cancel = True
 Me.Undo
 MsgBox "Its to late to order on todays date, welcome back tomorrow for new orders."
End If
End Sub
 
The way I would do this would be to have a main form that allows the user to open the order form using a command button.
If you then go to 'Build Event', code, you should see the code that opens the order form. You could add some extra code that would open the "Its too late form..." when the time is between 09.00 - 11.00, and open the order form all other times. You would have to use the IF statement and time function, and it would look something like this:


Dim stLinkCriteria As String

If Time() > TimeValue("09:00") And Time() < TimeValue("11:00") Then
DoCmd.OpenForm "TooLateForm", , , stLinkCriteria
Else
DoCmd.OpenForm "OrderForm", , , stLinkCriteria
End If
 
Thanks.


Works as i planned!


Thanks for the help.
 

Users who are viewing this thread

Back
Top Bottom