Subform requery error

Les Isaacs

Registered User.
Local time
Today, 14:15
Joined
May 6, 2008
Messages
186
Hi All

I know this is an 'old chestnut' - and it's one I thought I had cracked: but I'm getting an error and don't know why:mad:

I have a main form [form1] with two subforms [frmEnterResults] and [frmOFResults]. The AfterInsert event for [frmEnterResults] is:

Forms!form1.frmOFResults.Form.Requery

But when I enter a new record on the subform [frmEnterResults] I get
"runtime error 2465 Application-defined or object-defined error"

The same thing happens if I open [frmEnterResults] directly (rather than as a subform of [form1]) and enter a new record.

I really though I knew the syntax for referring to subforms, but seemingly not:banghead:

If anyone can help I'd be extremely grateful.
Many thanks
Les
 
Check this link for the correct syntax for referring to forms/sub forms their controls and properties from various relative locations.

I suspect you should be using ;
Code:
Forms!form1[B][COLOR="Red"]![/COLOR][/B]frmOFResults.Form.Requery
 
Hi John
Thanks for your reply.
There seems to be more than one syntax for referring to subforms, and the one I was using does work - when used with the correct control names!!
I have just discovered that my subforms are called 'child1', 'child2', etc, not [frmEnterResults] and [frmOFResults] as I had supposed ... and guess what - when I amend these names everything works perfectly !!!!!!
Thanks again anyway.
Les
 

Users who are viewing this thread

Back
Top Bottom