G
Guest
I am trying to make some code work and I get the following Visual Basic error:
Run-Time Error 3734
Database has been placed in a state by user "Admin" On Machine "Computer"
that prevents it from being opened or locked.
I have been stripping down the code I am running and I think I have found
the culprit. When testing different lines in the immediately window, and
using this part of the code "Set dbs = CurrentDb" I can recreate the error
message I get when I attempt to run the code. Why would I get this error?
The following is the stripped down code I am running:
Private Sub Command8_Click()
Dim dbs As DAO.Database
Dim wrk As DAO.Workspace
Dim strSQL As String, strQuery As String, strMessage As String
strSQL = "UPDATE tblTimerDate SET LastTimerDate = " & _
Format(Date, "\#mm/dd/yyyy\#")
On Error GoTo Err_Handler
If Time() > #6:30:00 AM# Then
If DLookup("LastTimerDate", "tblTimerDate") < Date Then
Set wrk = DAO.DBEngine.Workspaces(0)
Set dbs = CurrentDb
' Appends Rx table to RX1 table "Adds new RX's to RX1 table"
strQuery = "1Append Rx to RX1 Query"
dbs.Execute strQuery, dbFailOnError
End If
End If
Exit_Here:
Exit Sub
Err_Handler:
strMessage = Error & vbNewLine & vbNewLine & _
"(Error in " & strQuery & ")" & _
vbNewLine & vbNewLine & "Transaction rolled back and no tables
updated."
MsgBox strMessage, vbExclamation, "Error"
Resume Exit_Here
End Sub
Thanks,
Dennis
Run-Time Error 3734
Database has been placed in a state by user "Admin" On Machine "Computer"
that prevents it from being opened or locked.
I have been stripping down the code I am running and I think I have found
the culprit. When testing different lines in the immediately window, and
using this part of the code "Set dbs = CurrentDb" I can recreate the error
message I get when I attempt to run the code. Why would I get this error?
The following is the stripped down code I am running:
Private Sub Command8_Click()
Dim dbs As DAO.Database
Dim wrk As DAO.Workspace
Dim strSQL As String, strQuery As String, strMessage As String
strSQL = "UPDATE tblTimerDate SET LastTimerDate = " & _
Format(Date, "\#mm/dd/yyyy\#")
On Error GoTo Err_Handler
If Time() > #6:30:00 AM# Then
If DLookup("LastTimerDate", "tblTimerDate") < Date Then
Set wrk = DAO.DBEngine.Workspaces(0)
Set dbs = CurrentDb
' Appends Rx table to RX1 table "Adds new RX's to RX1 table"
strQuery = "1Append Rx to RX1 Query"
dbs.Execute strQuery, dbFailOnError
End If
End If
Exit_Here:
Exit Sub
Err_Handler:
strMessage = Error & vbNewLine & vbNewLine & _
"(Error in " & strQuery & ")" & _
vbNewLine & vbNewLine & "Transaction rolled back and no tables
updated."
MsgBox strMessage, vbExclamation, "Error"
Resume Exit_Here
End Sub
Thanks,
Dennis