Referencing subforms control from main form invalid reference error

  • Thread starter Cyberwolf0000 via AccessMonster.com
  • Start date
C

Cyberwolf0000 via AccessMonster.com

I am getting an invalid reference error on this line:

If IsNull(Me.VerInfo_subform.Form!VerInfoID) then

It states that I have an invalid reference to the Property Form/Report

I have tried several iterations of this lie

If IsNull(Forms!frm_EstToActSingle!VerInfo_subform.Form!VerInfoID)
And
If IsNull(Forms!frm_EstToActSingle!VerInfo_subform!VerInfoID)
And
If IsNull(Me.VerInfo_subform!VerInfoID)

with no luck. It gives me the same or a similar error. I am very frustrated
on this! Any help would be appreciated.

TIA
 
A

Allen Browne

The name of the subform *control* may not be the same as the name of the
form loaded into it (its SourceObject.)

Open the main form in design view.
Right-click the edge of the subform control, and choose Properties.
Make sure the Title bar of the Properties box says "Subform", and look at
the Name property. That's the name you need.

If you are still stuck, open the Immediate Window (Ctrl+G), and enter:
? Forms!frm_EstToActSingle!VerInfo_subform.Name

If that works, ask what kind of control it is:
? TypeName(Forms!frm_EstToActSingle!VerInfo_subform)

If that works, see if it is supposed to have a subform in it:
? Forms!frm_EstToActSingle!VerInfo_subform.SourceObject

Then see if it does have a subform in it:
? Forms!frm_EstToActSingle!VerInfo_subform.Form.Name

Hopefully those debugging steps will help you pin down the source of the
problem.
 
C

Cyberwolf0000 via AccessMonster.com

Thanks Allen,

I know I can always count on you to point me in the right direction.

Allen said:
The name of the subform *control* may not be the same as the name of the
form loaded into it (its SourceObject.)

Open the main form in design view.
Right-click the edge of the subform control, and choose Properties.
Make sure the Title bar of the Properties box says "Subform", and look at
the Name property. That's the name you need.

If you are still stuck, open the Immediate Window (Ctrl+G), and enter:
? Forms!frm_EstToActSingle!VerInfo_subform.Name

If that works, ask what kind of control it is:
? TypeName(Forms!frm_EstToActSingle!VerInfo_subform)

If that works, see if it is supposed to have a subform in it:
? Forms!frm_EstToActSingle!VerInfo_subform.SourceObject

Then see if it does have a subform in it:
? Forms!frm_EstToActSingle!VerInfo_subform.Form.Name

Hopefully those debugging steps will help you pin down the source of the
problem.
I am getting an invalid reference error on this line:
[quoted text clipped - 13 lines]
frustrated
on this! Any help would be appreciated.

--
James B Gaylord
For the Wolf comes the strength of the Pack,
For the Pack comes the strength of the Wolf,
-R. Kipling
Office 2003 on Win XP SP2
 
C

Cyberwolf0000 via AccessMonster.com

Cyberwolf0000 said:
Thanks Allen,

I know I can always count on you to point me in the right direction.
The name of the subform *control* may not be the same as the name of the
form loaded into it (its SourceObject.)
[quoted text clipped - 24 lines]
OK, when I type the 4 lines in the immediate window when I am in design view
they all return what I would expect.

But when I am in form view this line:
? Forms!frm_EstToActSingle!VerInfo_subform.Form.Name
returns the error that I was having before.
Any Ideas. I did do a debug & compile to make sure there was nothing
obviously wrong.

--
James B Gaylord
For the Wolf comes the strength of the Pack,
For the Pack comes the strength of the Wolf,
-R. Kipling
Office 2003 on Win XP SP2
 
A

Allen Browne

So the TypeName() indicates that it is a subform control, and the
SourceObject indicates the expected form name; the form is there in design
view, but not in Form view.

There are reasons why that might be the case (e.g. if your code unloads the
subform from the subform control, by clearing the SourceObject, or if some
other form has this subform open in design view, or ...)

You might try walking through the steps for this recovery sequence:
http://allenbrowne.com/recover.html

If you are using A2003 SP3, you might also want to make sure you have this
hotfix applied:
http://support.microsoft.com/kb/945674

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Cyberwolf0000 via AccessMonster.com said:
Cyberwolf0000 said:
Thanks Allen,

I know I can always count on you to point me in the right direction.
The name of the subform *control* may not be the same as the name of the
form loaded into it (its SourceObject.)
[quoted text clipped - 24 lines]
frustrated
on this! Any help would be appreciated.
OK, when I type the 4 lines in the immediate window when I am in design
view
they all return what I would expect.

But when I am in form view this line:
? Forms!frm_EstToActSingle!VerInfo_subform.Form.Name
returns the error that I was having before.
Any Ideas. I did do a debug & compile to make sure there was nothing
obviously wrong.

--
James B Gaylord
For the Wolf comes the strength of the Pack,
For the Pack comes the strength of the Wolf,
-R. Kipling
Office 2003 on Win XP SP2
 

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