E
Edo
I have a FE/BE-db with the possibility to block the db for maintenance. After
the startform a hidden form will be opened which checks the table settings
for a value. If the value is yes, then the db will be closed and locked. If
it is no, then the mainform will open.
I just found out this is not working properly. The shutting down and
blocking of the db is no problem. But opening the mainform is in a loop. The
form opens directly after shutting down the form.
I checked where the problem lies by opening the db in designmode and then
open the mainform, it causes no problem. But when I open the hidden form the
main is in a loop again.
The code below I found in a sample db which I found in the internet. I just
added the line: >else >DoCmd.OpenForm "frmStoringen" to open the mainform if
the db isn’t blocked. Somewhere I’v done something wrong. Who can help me out?
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 = "De database is tijdelijk gesloten voor onderhoud!" & vbCrLf & vbCrLf
& "Probeer later nog eens."
MsgBox msg
Application.Quit
End If
DoCmd.Hourglass False
End Sub
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
Me.TimerInterval = 300000
If Me.Tag = "MsgSent" Then
Application.Quit (acQuitSaveAll)
Else
Me.Tag = "MsgSent"
DoCmd.OpenForm "frm_ExitNow"
End If
Else
DoCmd.OpenForm "frmStoringen"
End If
End Sub
the startform a hidden form will be opened which checks the table settings
for a value. If the value is yes, then the db will be closed and locked. If
it is no, then the mainform will open.
I just found out this is not working properly. The shutting down and
blocking of the db is no problem. But opening the mainform is in a loop. The
form opens directly after shutting down the form.
I checked where the problem lies by opening the db in designmode and then
open the mainform, it causes no problem. But when I open the hidden form the
main is in a loop again.
The code below I found in a sample db which I found in the internet. I just
added the line: >else >DoCmd.OpenForm "frmStoringen" to open the mainform if
the db isn’t blocked. Somewhere I’v done something wrong. Who can help me out?
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 = "De database is tijdelijk gesloten voor onderhoud!" & vbCrLf & vbCrLf
& "Probeer later nog eens."
MsgBox msg
Application.Quit
End If
DoCmd.Hourglass False
End Sub
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
Me.TimerInterval = 300000
If Me.Tag = "MsgSent" Then
Application.Quit (acQuitSaveAll)
Else
Me.Tag = "MsgSent"
DoCmd.OpenForm "frm_ExitNow"
End If
Else
DoCmd.OpenForm "frmStoringen"
End If
End Sub