NimbusSoftware
Registered User.
- Local time
- Today, 17:51
- Joined
- Feb 18, 2005
- Messages
- 19
I have networked frontend and backend databases. I'm also experiencing locking errors (3051) when two or more people are using the frontend interface. I always .close and =nothing any CurrentDB or recordset object. All SQL is executed in the following sub:
strSQL is the SQL string & fWS is the workset flag.
Is there an issue with SQL_Action or do I have a flaky network?
Code:
' Mouse pointer property
Global Const MP_DEFAULT As Integer = 0
Global Const MP_HOURGLASS As Integer = 11
Public Function SQL_Action(strSQL As String, Optional fWS As Boolean = False) As Boolean
On Error GoTo ErrorHandler
Dim db As Database
Dim sngStart As Single
Dim wrk As Workspace
Screen.MousePointer = MP_HOURGLASS
Try:
Set db = CurrentDb
If fWS Then Set wrk = DBEngine.Workspaces(0)
If fWS Then wrk.BeginTrans
db.Execute strSQL
UpdateUsage strSQL
If fWS Then wrk.CommitTrans
SQL_Action = True
GoTo ExitHere
ErrorHandler:
Select Case Err.Number
Case 3051
Err.Clear
sngStart = Timer
Do While Timer < sngStart + 5
DoEvents
Loop
GoTo Try
End Select
If fWS Then wrk.Rollback
ErrorHandler VBE.ActiveCodePane.CodeModule & vbnewline & _
"basSQL_Functions" & vbnewline & _
"SQL_Action"
ExitHere:
On Error Resume Next
If fWS Then
wrk.Close
Set wrk = Nothing
End If
db.Close
Set db = Nothing
Screen.MousePointer = MP_DEFAULT
End Function
Is there an issue with SQL_Action or do I have a flaky network?