Set program to close at preset time

How to set program to close at preset time

The following How To will demonstrate how to force Access program to close at 5:00 PM of the day if program is left open before 5:00 PM. The warning message will pop up 5 minutes before closing.

1. We need two unbound text boxes on your form. Name them as Systime and TextTime. Under the Form Design view, under the Property Sheet of text box Systime, assign a Control Source = TimeValue(now()) as shown below:

systime textbox

 

 

 

 

 

 

2. Under the Property Sheet of text box TextTime, do not change anything. We will assign TextTime = current system time under the Timer Event of form on next step.

timefmt

 

txtTime

 

 

 

 

 

 

3. Under the On Timer Event of Form, assign a current time to a text box TextTime with a specified format as HH:mm:ss AM/PM for 10:51:11 AM.

form timer eventDosage: Sildenafil citrate purchase cialis from india is conveyed orally as 25 mg, 50 mg and 100 mg. For this reason it is in soft viagra pills addition called as the male sex hormone since it manifests all the distinctive male persona and bodily progressions. The good thing is that there are no after effects in the future due to the effects purchasing viagra in canada which is gives to people. Moreover, focusing on healthy lifestyle ensures an overall well-being and long free samples cialis life.
4. Set a warning popup message 5 minutes before close the application. User If Statement followed by the message box. Then use the command Docmd.Quit if a current time = the specified close time in the second If Statement. The application will be forced to closed when the specified close time is reached regardless of the pop-up message is closed or not.

warning time

 

 

 

 

Private Sub Form_Timer()
'Set TextTime box to current time with format of 10:50:14 AM/PM
Me.TextTime.Value = Format(Time, "HH:mm:ss AM/PM")
'Give a warning message 5 minutes before 5 PM
If Me.TextTime = # 4:55:00 PM# Then
    MsgBox "You have 5 minutes until 5 PM. Program will close at 5 PM!", vbCritical, "Time Warning"
End If
'Close program at 5:00 PM regardless of message closed or not
If Me.TextTime = #5:00:00 PM# Then
       DoCmd.Quit
End If
End Sub

autoDatetxt

 

 

 

 

 

 

 

 

Related Video:

Related posts

2 Thoughts to “Set program to close at preset time”

  1. I am sure this article has touched all the internet viewers, its really
    really good article on building up new blog.

  2. Hello, I log on to your blogs regularly. Your writing style is awesome, keep iit
    up!

Comments are closed.