I am using Access 2010
I am suddenly getting the error 3048: Cannot open any more databases
The error occurs on the line of code: Set db = CurrentDb()
I always open recordsets as coded above, and close them as coded below.
Why should I suddenly get this error? The error appears to be in a loop. If I close the error message, it pops up again. I have to close the database using Windows Task Manager.
Is there a maximum number of connections? But I religiously close connections as indicated above!
I am only connecting to the current database (backend form frontend)
Am I opening / closing connections & recordsets correctly?
I am suddenly getting the error 3048: Cannot open any more databases
The error occurs on the line of code: Set db = CurrentDb()
Code:
Private Sub SetInUseFalse(TelesalesId As Long)
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("Select InUseBy from tblTelesales where Telesalesid = " & TelesalesId)
Run Some Code
CloseRecordSet rst
SetObjectToNothing db
End Sub
Code:
Public Sub CloseRecordSet(RecordsetName)
On Error GoTo Err_Handler
If Not RecordsetName Is Nothing Then
RecordsetName.Close
Set RecordsetName = Nothing
GoTo Exit_Sub
End If
Exit_Sub:
Exit Sub
Err_Handler:
Select Case Err.Number
Case 0
Resume Exit_Sub
Case 3420
Resume Exit_Sub
Case Else
MsgBox Err.Number & " - " & Err.Description
Resume Exit_Sub
End Select
End Sub
Code:
Public Sub SetObjectToNothing(ObjectName)
On Error GoTo Err_Handler
If Not ObjectName Is Nothing Then
Set ObjectName = Nothing
End If
Exit_Sub:
Exit Sub
Err_Handler:
Select Case Err.Number
Case 0
Resume Exit_Sub
Case 9126
Resume Exit_Sub
Case Else
MsgBox Err.Number & " - " & Err.Description
Resume Exit_Sub
End Select
End Sub
Is there a maximum number of connections? But I religiously close connections as indicated above!
I am only connecting to the current database (backend form frontend)
Am I opening / closing connections & recordsets correctly?