Today I've started getting error 3048 "Cannot open any more databases" but I don't know why. Happens at about 22/23 calls to this function
Any ideas?
Code: Select all
Function GetEmailAddress(strIn As String) As String
Dim db As DAO.Database
Set db = CurrentDb
Dim rst As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT * FROM EmployeeListing WHERE [Corporate ID] = '" & strIn & "' OR [Employee ID] = '" & strIn & "'"
Set rst = db.OpenRecordset(strSQL, dbOpenForwardOnly)
If rst.EOF And rst.BOF Then
'Nothing Found
GetEmailAddress "NONE"
Else
GetEmailAddress = rst![Email Address (Work)]
End If
rst.Close
Set rst = Nothing
Set db = Nothing
End Function