S
Swordfish
Hello
I came across this old coding that when you change the value of Logoff in
the Setting table to Yes, the users should get frmExitNow message on the
screen telling them that they will be logged off in 5 minutes.
The Switchboard form checks this field every 5 minutes and launches the
message form. If they still have not logged off after another 5 minutes,
they will be automatically logged off. It will also not allow anyone else to
log into the application until Logoff is set back to No.
When I change the logoff to yes, the message "The database is closed for
updating" "Please try late†pops up and automatically closes the database.
What I would like and what should happen is the frmExitNow message to appear
first to warn the users then the after 5minute the actually Logoff message.
Would the DAO make a different here? Any assistance will be appreciated.
Thanks
It has several pieces;
1. Code in the frmLogOff form (this form) OnTimer and OnLoad events, the
Timer Interval is set for 5 minutes: 300000. The same code is in my
Switchboard.
On Timer is as follows:
Private Sub Form_Timer()
Dim db As DAO.Database
Dim snp As DAO.Recordset
Dim msg As String, intLogoff As Integer
Set db = CurrentDb
Set snp = db.OpenRecordset("Settings", dbOpenSnapshot)
intLogoff = snp![logoff]
snp.Close
db.Close
If intLogoff = True Then
If Me.Tag = "MsgSent" Then
Application.Quit (acQuitSaveAll)
Else
Me.Tag = "MsgSent"
DoCmd.OpenForm "frmExitNow"
End If
End If
End Sub
OnLoad event as follows:
Private Sub Form_Load()
Dim db As DAO.Database
Dim snp As DAO.Recordset
Dim msg As String
Set db = CurrentDb
Set snp = db.OpenRecordset("Settings", dbOpenSnapshot)
If snp![logoff] Then
msg = "The database is closed for updating" & vbCrLf & vbCrLf & "Please try
later."
MsgBox msg
Application.Quit
End If
DoCmd.Hourglass False
End Sub
2. A linked table called 'Settings' with only one Yes/No field called
'Logoff' in the BackEnd and linked table in the FrontEnd.
3. There is the frmExitNow modal form with the message: This application
will automatically close in 5 minutes for maintenance. Please exit as soon as
possible.
You may try opening the application again in 10 minutes.
The coding as follows:
Private Sub Form_Load()
Detail.BackColor = vbYellow
Label0.ForeColor = vbRed
End Sub
Private Sub Form_Timer()
DoCmd.Beep
If Detail.BackColor = vbYellow Then
Detail.BackColor = vbRed
Label0.ForeColor = vbYellow
Else
Detail.BackColor = vbYellow
Label0.ForeColor = vbRed
End If
End Sub
I came across this old coding that when you change the value of Logoff in
the Setting table to Yes, the users should get frmExitNow message on the
screen telling them that they will be logged off in 5 minutes.
The Switchboard form checks this field every 5 minutes and launches the
message form. If they still have not logged off after another 5 minutes,
they will be automatically logged off. It will also not allow anyone else to
log into the application until Logoff is set back to No.
When I change the logoff to yes, the message "The database is closed for
updating" "Please try late†pops up and automatically closes the database.
What I would like and what should happen is the frmExitNow message to appear
first to warn the users then the after 5minute the actually Logoff message.
Would the DAO make a different here? Any assistance will be appreciated.
Thanks
It has several pieces;
1. Code in the frmLogOff form (this form) OnTimer and OnLoad events, the
Timer Interval is set for 5 minutes: 300000. The same code is in my
Switchboard.
On Timer is as follows:
Private Sub Form_Timer()
Dim db As DAO.Database
Dim snp As DAO.Recordset
Dim msg As String, intLogoff As Integer
Set db = CurrentDb
Set snp = db.OpenRecordset("Settings", dbOpenSnapshot)
intLogoff = snp![logoff]
snp.Close
db.Close
If intLogoff = True Then
If Me.Tag = "MsgSent" Then
Application.Quit (acQuitSaveAll)
Else
Me.Tag = "MsgSent"
DoCmd.OpenForm "frmExitNow"
End If
End If
End Sub
OnLoad event as follows:
Private Sub Form_Load()
Dim db As DAO.Database
Dim snp As DAO.Recordset
Dim msg As String
Set db = CurrentDb
Set snp = db.OpenRecordset("Settings", dbOpenSnapshot)
If snp![logoff] Then
msg = "The database is closed for updating" & vbCrLf & vbCrLf & "Please try
later."
MsgBox msg
Application.Quit
End If
DoCmd.Hourglass False
End Sub
2. A linked table called 'Settings' with only one Yes/No field called
'Logoff' in the BackEnd and linked table in the FrontEnd.
3. There is the frmExitNow modal form with the message: This application
will automatically close in 5 minutes for maintenance. Please exit as soon as
possible.
You may try opening the application again in 10 minutes.
The coding as follows:
Private Sub Form_Load()
Detail.BackColor = vbYellow
Label0.ForeColor = vbRed
End Sub
Private Sub Form_Timer()
DoCmd.Beep
If Detail.BackColor = vbYellow Then
Detail.BackColor = vbRed
Label0.ForeColor = vbYellow
Else
Detail.BackColor = vbYellow
Label0.ForeColor = vbRed
End If
End Sub