I have a form that has 4 subforms. The subforms use Parent/Child link to bring the correct number of records up. That part works fine.
On each subform I have an unbound textbox called [txtWaitEnd] that when the that textbox has the focus I execute the following (ALL THE SUBFORMS HAVE THIS SAME UNBOUND TEXTBOX and VBCode):
Private Sub txtWaitEnd_GotFocus()
Dim strSQL As String
Dim rs As DAO.Recordset
Dim a As Long, b As Long, c As Long
a = Me.LVLInfoID
strSQL = "SELECT LVLInfoDtailID, LVLInfoID, LVLMachPollPositionID From tbl_LVLInfoDetails WHERE LVLInfoID=" & a
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
If rs.RecordCount > 0 Then
b = rs.RecordCount
.FindFirst "[LVLMachPollPositionID] = " & Me.LVLMachPollPositionID
If .AbsolutePosition = b - 1 Then
Set rs = Nothing
This works right to cycle thru all of the records on each subform and if it's the last record for that subform then it goes to the next subform etc....
However, the problem is when I get to the last record of the 4th subform. When the txtWaitEnd gets the focus I get the error:
'Run-time error '3048':
Cannot open any more databases.
I don't understand why I'd get this since in each subform I'm "closing" and setting each DAO.recordset to Nothing at the end of every vb instruction.