Hi
I have an access 2000 database running a custom application. I have a
record management form which displays all the details for an item in the
system, (covers 4 main tables, decending in details 1 -< 2 -< 3 -< 4 >- 5 and
a lookup). The fornt end stores the code, and the backend data store is
another access 2000 db linked in.
The problem is when I use the search for another record code I've written,
it works fine for the first 7 or 8 searches, then I get an error message
Error 3000 "Reserved Error (-1104) There is no msg for this error" then
after that another message "Run Time Error 3048 Cannot open any more
databases". If I close the form and re-open it it works fine for another 7/8
hits. I don't understand it as the code to search for another record closes
the main form, opens a search form, and then reopens the main form with a new
filter.
The control code is:
+++++++++++++++++++++++++++++++++++++++++++++++
Private Sub cmdNext_Click()
On Error GoTo err1
Dim fStock As Boolean
''
' release the lock on the current ticket number
''
clearLock Me!rTicketNumber
fStock = Me!iStock
DoCmd.Close acForm, Me.Name
If fStock = True Then
stockenquiry
Else
openMgtEnquiry
End If
end_err1:
Exit Sub
err1:
MsgBox Err.Description, vbCritical, "Error No. " & Err.Number
Resume end_err1
end sub
+++++++++++++++++++++++++++++++++++++++++++++++++
The error occurs on the docmd.RunSQL line of the following function
the variable strSql contains
DELETE FROM jrmLock WHERE lRTicketNumber = 'A00008'
+++++++++++++++++++++++++++++++++++++++++++++++++
Public Function clearLock(strTicketNumber As String)
'on error goto err1
Dim strSQL As String
strSQL = " DELETE FROM jrmLock " & _
" WHERE lRTicketNumber = '" & strTicketNumber & "'"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
end_err1:
Exit Function
err1:
MsgBox Err.Description, vbCritical, "clearLock Error " & Err.Number
Resume end_err1
End Function
+++++++++++++++++++++++++++++++++++++++++++++++++
HELP PLEASE ... This is driving me NUTS.
Regards
Mark
sparker - 24 Jul 2005 10:09 GMT
Not sure that this is your problem... However, there is a finite number of
databases you can have open at one time. If the problem is that, then all you
need to do is make sure you close the databases as you finish working with
them, as in this example function, and the same is true for subs. Once again
I do not know if this is your problem so... Notice I close the database at
the end when I am finished with it:
Public Function ReturnDesiredValue() As String
Dim daoDbs As DAO.Database
Dim daoRec As DAO.Recordset
Dim strSql As String
Set daoDbs = CodeDb
strSql = "Select * From MyTable;"
Set daoRec = daoDbs.OpenRecordset(strSql)
If Not (daoRec.BOF And daoRec.EOF) Then
ReturnDesiredValue = daoRec("FieldDesired").Value
Else
ReturnDesiredValue = "None"
End If
strSql = ""
daoRec.Close
daoDbs.Close
End Function
-- Take Care & God Bless ~ SPARKER ~
> Hi
>
[quoted text clipped - 69 lines]
> Regards
> Mark