From Main form, check for new record in subform

G

Guest

From the main form, I want to check if there is a new record in a subform.
I get the following error message: "Object doesn't support this property or
method". I'm using the following code:

Private Sub Add_Record_Click()
Dim intnewrec As Integer
intnewrec = Forms![Name of Main Form]![Name of Subform].NewRecord
If intnewrec = True Then
MsgBox "You're at the new record in the subform." _
End If
End Sub
 
A

Allen Browne

Add the .Form bit to refer to the form in the subform control:
If Me![Name of Subform].Form.NewRecord Then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top