my code runs without issue; EXCEPT that at the end of it, i get the error: "cannot open anymore data bases"
although it ought not to matter, there are
...146 records in tbeFixtureTypeDetails
and
...114 records in tbeSubmittalDetails
(learn something new every day... I'm lost on this one.)
any suggestions would be appreciated in advance,
best, stay well,
m.
Code:Public Sub SubmtlStatusSmry() On Error GoTo Err_SmtlTypeStatusSmry Dim dbs As Database Dim rst As DAO.Recordset Dim rst1 As DAO.Recordset Dim intDetail_Cnt As Integer Dim intTypeSubmtl_Cnt As Integer Dim vMAX_ID As Integer CurrentDb.Execute ("DELETE * FROM tbeSubmittalDetailSmry_temp") intDetail_Cnt = DCount("*", "tbeSubmittalDetails") If intDetail_Cnt > 0 Then Set dbs = CurrentDb Set rst = _ dbs.OpenRecordset("SELECT * " & _ "FROM tbeFixtureTypeDetails WHERE NOT void", _ dbOpenDynaset) With rst DoCmd.GoToRecord , "", acFirst Do Until .EOF intTypeSubmtl_Cnt = DCount("*", "tbeSubmittalDetails", "type = '" & rst!Type & "'") If intTypeSubmtl_Cnt > 0 Then Set rst1 = Nothing Set rst1 = dbs.OpenRecordset("SELECT * FROM tbeSubmittalDetails WHERE type = '" & rst!Type & "' ORDER BY SubmittalID DESC") vMAX_ID = rst1!SubmittalID 'add the type CurrentDb.Execute _ "INSERT INTO tbeSubmittalDetailSmry_temp " & _ "(Type, SubmittalID, Action) " & _ "SELECT Type, SubmittalID, Action FROM tbeSubmittalDetails WHERE Type = '" & rst!Type & "' AND SubmittalID = " & vMAX_ID rst1.Close Set rst1 = Nothing Else ' add code for "no SUBMITTAL yet Received" End If .MoveNext Loop End With 'housekeeping rst.Close dbs.Close Set rst = Nothing Set dbs = Nothing Else MsgBox "There are no entries to summarize" End If Exit_SmtlTypeStatusSmry: Exit Sub Err_SmtlTypeStatusSmry: MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure SmtlTypeStatusSmry, line " & Erl & "." Resume Exit_SmtlTypeStatusSmry: End Sub