Let's take care of one issue that is not associated with the error you are getting.
The following has a .MoveFirst method inside of a loop. Let's fix that now.
Code:
'=========================
Do While Not rst2.EOF
'===============================
If rst2.EOF = True Then GoTo exit_proc
rst2.MoveFirst
'If intPic > 0 Then rst2.Move intPic
rst2.Delete
'Update the parent record
rst1.Update
'====================
rst1.MoveNext
Loop
'======================
We need to move it outside the loop, before the loop. So let's do the recordset validation and the MoveFirst before the loop. Need to validate that the recordset holds actual records before we tell it to .MoveFirst. It ca not .MoveFirst without first retrieveing some records.
You will still get an error with the following but we need to take small steps.
Code:
'=========================
rst2.OpenRecordset
If rst2.EOF = True Then GoTo exit_proc
rst2.MoveFirst
'=========================
'If intPic > 0 Then rst2.Move intPic
Do While Not rst2.EOF
'===============================
rst2.Delete
'Update the parent record
rst1.Update
'====================
rst1.MoveNext
Loop
'======================
So let's comment out the loop and see if this is the differnce between getting an error or not, for now.
Code:
'=========================
rst2.OpenRecordset
If rst2.EOF = True Then GoTo exit_proc
rst2.MoveFirst
'=========================
'If intPic > 0 Then rst2.Move intPic
' Do While Not rst2.EOF
'===============================
rst2.Delete
'Update the parent record
rst1.Update
'====================
rst1.MoveNext
' Loop
'======================