Roger Carlson wrote:
If I was checking to see if the subform is empty, I'd use:
Private Sub Form_Current()
If Me.RecordSetClone.EOF Then
'do stuff here
End If
End Sub
However, I believe this requires DAO.
Hehe, okay, that fixes my test database. :-)
However I can not use this fix in my production database as the subform's
RecordSource is set dynamically. When Form_Current() of the subform is
called I have to check if Me.RecordSet Is Nothing. Checking if
Me.RecordSetClone Is Nothing results in another runtime error 7951.
I changed the test database. Now it is more similar to my production
database. So unfortunately your fix doesn't work anymore. The subform is now
unbound. The main form sets the subform's RecordSource when it is opened:
Private Sub Form_Open(Cancel As Integer)
Me![subform].Form.RecordSource = "SELECT tblA.ID FROM tblA, tblB WHERE
tblA.ID=tblB.fkA And tblB.ID=1"
End Sub
My question stands: What exactly causes runtime error 3021 when the forms
are closed?
Boris
|