My form needs to requery every 5 minutes to update data, this I have working successfully. I also have to close the database down at a specific time to allow the server to complete maintenance tasks.
This is my code:
Code: Select all
Private Sub Form_Load()
Me.TimerInterval = 300000
End Sub
Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
Me.txtStop.SetFocus
End Sub
Private Sub Form_Timer()
Me.Painting = False
[sbfInProgressWithECD].Requery
[sbfCompletedToday].Requery
[sbfCountOfCompletions].Requery
[sbfInProgressTBA].Requery
[sbfInProgressECDB4].Requery
[sbfInProgressMon].Requery
[sbfInProgressTues].Requery
[sbfInProgressWeds].Requery
[sbfInProgressThurs].Requery
[sbfInProgressFri].Requery
[sbfInProgressSat].Requery
Me.Refresh
Me.txtStop.SetFocus
Me.SetFocus
Me.Painting = True
If Time = TimeValue("01:45") Then
DoCmd.Quit acQuitSaveAll
End If
End Sub
I moved the second coding to the main form which is frmWIP ( as above) in the hope that this would work, it doesn't I think because it can't capture the time exactly so missing its opportunity.
Can anyone take a look and advise the best method to allow this to work?
1, Requery the database.
2, Close down at a specific time.
Thanks