Invalid Reference

C

Craig

I'm modifying an app that was developed using Access 97. The following code
generates this error:

"2455: You entered an expression that has an invalid reference to the
property form/report. The property may not exist or may not apply to the
object you specified."

**********************************
Public Function mSetForm(sParent As String, iPageCnt As Integer)

On Error GoTo Proc_Err
Dim i As Integer
Dim frm As Form
i = 0

Set frm = Forms![MyMainForm]

frm.subFrmPageTabs!txtPageCnt = iPageCnt

Proc_Exit:
Exit Function

Proc_Err:
MsgBox Err.Number & "; " & Err.Description
Resume Proc_Exit
End Function
************************************

The error occurs at the "frm.subFrmPageTabs!txtPageCnt = iPageCnt" line. I
have a subform called "subFrmPageTabs" on "MyMainForm" that has a text box
that I'm setting to a value. That's it. Have I not declared something?
What am I missing?

Thanks for any and all help.
 
C

Craig

Thanks for the quick response Allen - however, I still get the same error.
I'm sensing there may be corruption.

--
Craig


Allen Browne said:
Try:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

A2003 is more pedantic about the .Form bit.

Explanation:
http://allenbrowne.com/casu-04.html

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

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

Craig said:
I'm modifying an app that was developed using Access 97. The following
code
generates this error:

"2455: You entered an expression that has an invalid reference to the
property form/report. The property may not exist or may not apply to the
object you specified."

**********************************
Public Function mSetForm(sParent As String, iPageCnt As Integer)

On Error GoTo Proc_Err
Dim i As Integer
Dim frm As Form
i = 0

Set frm = Forms![MyMainForm]

frm.subFrmPageTabs!txtPageCnt = iPageCnt

Proc_Exit:
Exit Function

Proc_Err:
MsgBox Err.Number & "; " & Err.Description
Resume Proc_Exit
End Function
************************************

The error occurs at the "frm.subFrmPageTabs!txtPageCnt = iPageCnt" line.
I
have a subform called "subFrmPageTabs" on "MyMainForm" that has a text box
that I'm setting to a value. That's it. Have I not declared something?
What am I missing?

Thanks for any and all help.
 
A

Allen Browne

Okay, to debug it:

1. Temporarily comment out the error handler, i.e.:
'On Error GoTo Proc_Err

2. Run the code. When it fails, it will stop at the problem line.
Chose Debug. We assume it will be this line:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

3. Open the Immediate Window (Ctrl+G), and ask Access to help you debug it.
Example questions:
? frm.Name
? TypeName(frm.subFrmPageTabs)
? frm.subFrmPageTabs.SourceObject
? frm.subFrmPageTabs.Form.Name
? TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox

That kind of thing should get you in touch with what's going on.

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

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

Craig said:
Thanks for the quick response Allen - however, I still get the same error.
I'm sensing there may be corruption.

--
Craig


Allen Browne said:
Try:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

A2003 is more pedantic about the .Form bit.

Explanation:
http://allenbrowne.com/casu-04.html

Craig said:
I'm modifying an app that was developed using Access 97. The following
code
generates this error:

"2455: You entered an expression that has an invalid reference to the
property form/report. The property may not exist or may not apply to
the
object you specified."

**********************************
Public Function mSetForm(sParent As String, iPageCnt As Integer)

On Error GoTo Proc_Err
Dim i As Integer
Dim frm As Form
i = 0

Set frm = Forms![MyMainForm]

frm.subFrmPageTabs!txtPageCnt = iPageCnt

Proc_Exit:
Exit Function

Proc_Err:
MsgBox Err.Number & "; " & Err.Description
Resume Proc_Exit
End Function
************************************

The error occurs at the "frm.subFrmPageTabs!txtPageCnt = iPageCnt"
line.
I
have a subform called "subFrmPageTabs" on "MyMainForm" that has a text
box
that I'm setting to a value. That's it. Have I not declared
something?
 
C

Craig

Allen:

Thank you very much for your help...I will try this and report back to this
post with my findings.

Much appreciated.
--
Craig


Allen Browne said:
Okay, to debug it:

1. Temporarily comment out the error handler, i.e.:
'On Error GoTo Proc_Err

2. Run the code. When it fails, it will stop at the problem line.
Chose Debug. We assume it will be this line:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

3. Open the Immediate Window (Ctrl+G), and ask Access to help you debug it.
Example questions:
? frm.Name
? TypeName(frm.subFrmPageTabs)
? frm.subFrmPageTabs.SourceObject
? frm.subFrmPageTabs.Form.Name
? TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox

That kind of thing should get you in touch with what's going on.

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

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

Craig said:
Thanks for the quick response Allen - however, I still get the same error.
I'm sensing there may be corruption.

--
Craig


Allen Browne said:
Try:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

A2003 is more pedantic about the .Form bit.

Explanation:
http://allenbrowne.com/casu-04.html

I'm modifying an app that was developed using Access 97. The following
code
generates this error:

"2455: You entered an expression that has an invalid reference to the
property form/report. The property may not exist or may not apply to
the
object you specified."

**********************************
Public Function mSetForm(sParent As String, iPageCnt As Integer)

On Error GoTo Proc_Err
Dim i As Integer
Dim frm As Form
i = 0

Set frm = Forms![MyMainForm]

frm.subFrmPageTabs!txtPageCnt = iPageCnt

Proc_Exit:
Exit Function

Proc_Err:
MsgBox Err.Number & "; " & Err.Description
Resume Proc_Exit
End Function
************************************

The error occurs at the "frm.subFrmPageTabs!txtPageCnt = iPageCnt"
line.
I
have a subform called "subFrmPageTabs" on "MyMainForm" that has a text
box
that I'm setting to a value. That's it. Have I not declared
something?
 
C

Craig

Well, I get the same error when I run the debug window at the "?
TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox" line...

For some reason, it just doesn't recognize the text box on the subform, and
it's clearly there, typed correctly, etc.

--
Craig


Allen Browne said:
Okay, to debug it:

1. Temporarily comment out the error handler, i.e.:
'On Error GoTo Proc_Err

2. Run the code. When it fails, it will stop at the problem line.
Chose Debug. We assume it will be this line:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

3. Open the Immediate Window (Ctrl+G), and ask Access to help you debug it.
Example questions:
? frm.Name
? TypeName(frm.subFrmPageTabs)
? frm.subFrmPageTabs.SourceObject
? frm.subFrmPageTabs.Form.Name
? TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox

That kind of thing should get you in touch with what's going on.

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

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

Craig said:
Thanks for the quick response Allen - however, I still get the same error.
I'm sensing there may be corruption.

--
Craig


Allen Browne said:
Try:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

A2003 is more pedantic about the .Form bit.

Explanation:
http://allenbrowne.com/casu-04.html

I'm modifying an app that was developed using Access 97. The following
code
generates this error:

"2455: You entered an expression that has an invalid reference to the
property form/report. The property may not exist or may not apply to
the
object you specified."

**********************************
Public Function mSetForm(sParent As String, iPageCnt As Integer)

On Error GoTo Proc_Err
Dim i As Integer
Dim frm As Form
i = 0

Set frm = Forms![MyMainForm]

frm.subFrmPageTabs!txtPageCnt = iPageCnt

Proc_Exit:
Exit Function

Proc_Err:
MsgBox Err.Number & "; " & Err.Description
Resume Proc_Exit
End Function
************************************

The error occurs at the "frm.subFrmPageTabs!txtPageCnt = iPageCnt"
line.
I
have a subform called "subFrmPageTabs" on "MyMainForm" that has a text
box
that I'm setting to a value. That's it. Have I not declared
something?
 
A

Allen Browne

I take it that you worked down through the examples, and the previous line
worked, i.e.:
? frm.subFrmPageTabs.Form.Name

If so, you have the correct reference to the form. So, if you replace .Name
with !txtPageCnt and get the error, then txtPageCnt is not a valid name.

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

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

Craig said:
Well, I get the same error when I run the debug window at the "?
TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox" line...

For some reason, it just doesn't recognize the text box on the subform,
and
it's clearly there, typed correctly, etc.

--
Craig


Allen Browne said:
Okay, to debug it:

1. Temporarily comment out the error handler, i.e.:
'On Error GoTo Proc_Err

2. Run the code. When it fails, it will stop at the problem line.
Chose Debug. We assume it will be this line:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

3. Open the Immediate Window (Ctrl+G), and ask Access to help you debug
it.
Example questions:
? frm.Name
? TypeName(frm.subFrmPageTabs)
? frm.subFrmPageTabs.SourceObject
? frm.subFrmPageTabs.Form.Name
? TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox

That kind of thing should get you in touch with what's going on.

Craig said:
Thanks for the quick response Allen - however, I still get the same
error.
I'm sensing there may be corruption.

--
Craig


:

Try:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

A2003 is more pedantic about the .Form bit.

Explanation:
http://allenbrowne.com/casu-04.html

I'm modifying an app that was developed using Access 97. The
following
code
generates this error:

"2455: You entered an expression that has an invalid reference to
the
property form/report. The property may not exist or may not apply
to
the
object you specified."

**********************************
Public Function mSetForm(sParent As String, iPageCnt As Integer)

On Error GoTo Proc_Err
Dim i As Integer
Dim frm As Form
i = 0

Set frm = Forms![MyMainForm]

frm.subFrmPageTabs!txtPageCnt = iPageCnt

Proc_Exit:
Exit Function

Proc_Err:
MsgBox Err.Number & "; " & Err.Description
Resume Proc_Exit
End Function
************************************

The error occurs at the "frm.subFrmPageTabs!txtPageCnt = iPageCnt"
line.
I
have a subform called "subFrmPageTabs" on "MyMainForm" that has a
text
box
that I'm setting to a value. That's it. Have I not declared
something?
 
C

Craig

Interesting...I wonder what a 'valid' name is considered then. I can't see
why 'txtPageCnt' isn't one.

Thanks for your patience with this...

The debug window suggests the following for the activecontrol error I'm
getting: "The expression you entered requires the control to be in the
active window..."

PS Also, the line "?frm.subFrmPageTabs.Form.Name" returns an error. The
line "?frm.subFrmPageTabs.Name" returns the correct value.

....and you're right, the culprit seems to be the 'txtPageCnt'. But I've
tried changing the name, to no avail...
--
Craig


Allen Browne said:
I take it that you worked down through the examples, and the previous line
worked, i.e.:
? frm.subFrmPageTabs.Form.Name

If so, you have the correct reference to the form. So, if you replace .Name
with !txtPageCnt and get the error, then txtPageCnt is not a valid name.

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

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

Craig said:
Well, I get the same error when I run the debug window at the "?
TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox" line...

For some reason, it just doesn't recognize the text box on the subform,
and
it's clearly there, typed correctly, etc.

--
Craig


Allen Browne said:
Okay, to debug it:

1. Temporarily comment out the error handler, i.e.:
'On Error GoTo Proc_Err

2. Run the code. When it fails, it will stop at the problem line.
Chose Debug. We assume it will be this line:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

3. Open the Immediate Window (Ctrl+G), and ask Access to help you debug
it.
Example questions:
? frm.Name
? TypeName(frm.subFrmPageTabs)
? frm.subFrmPageTabs.SourceObject
? frm.subFrmPageTabs.Form.Name
? TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox

That kind of thing should get you in touch with what's going on.

Thanks for the quick response Allen - however, I still get the same
error.
I'm sensing there may be corruption.

--
Craig


:

Try:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

A2003 is more pedantic about the .Form bit.

Explanation:
http://allenbrowne.com/casu-04.html

I'm modifying an app that was developed using Access 97. The
following
code
generates this error:

"2455: You entered an expression that has an invalid reference to
the
property form/report. The property may not exist or may not apply
to
the
object you specified."

**********************************
Public Function mSetForm(sParent As String, iPageCnt As Integer)

On Error GoTo Proc_Err
Dim i As Integer
Dim frm As Form
i = 0

Set frm = Forms![MyMainForm]

frm.subFrmPageTabs!txtPageCnt = iPageCnt

Proc_Exit:
Exit Function

Proc_Err:
MsgBox Err.Number & "; " & Err.Description
Resume Proc_Exit
End Function
************************************

The error occurs at the "frm.subFrmPageTabs!txtPageCnt = iPageCnt"
line.
I
have a subform called "subFrmPageTabs" on "MyMainForm" that has a
text
box
that I'm setting to a value. That's it. Have I not declared
something?
 
C

Craig

I apologize...I just realized too that I didn't make clear that I am using
Access 97.
--
Craig


Allen Browne said:
I take it that you worked down through the examples, and the previous line
worked, i.e.:
? frm.subFrmPageTabs.Form.Name

If so, you have the correct reference to the form. So, if you replace .Name
with !txtPageCnt and get the error, then txtPageCnt is not a valid name.

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

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

Craig said:
Well, I get the same error when I run the debug window at the "?
TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox" line...

For some reason, it just doesn't recognize the text box on the subform,
and
it's clearly there, typed correctly, etc.

--
Craig


Allen Browne said:
Okay, to debug it:

1. Temporarily comment out the error handler, i.e.:
'On Error GoTo Proc_Err

2. Run the code. When it fails, it will stop at the problem line.
Chose Debug. We assume it will be this line:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

3. Open the Immediate Window (Ctrl+G), and ask Access to help you debug
it.
Example questions:
? frm.Name
? TypeName(frm.subFrmPageTabs)
? frm.subFrmPageTabs.SourceObject
? frm.subFrmPageTabs.Form.Name
? TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox

That kind of thing should get you in touch with what's going on.

Thanks for the quick response Allen - however, I still get the same
error.
I'm sensing there may be corruption.

--
Craig


:

Try:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

A2003 is more pedantic about the .Form bit.

Explanation:
http://allenbrowne.com/casu-04.html

I'm modifying an app that was developed using Access 97. The
following
code
generates this error:

"2455: You entered an expression that has an invalid reference to
the
property form/report. The property may not exist or may not apply
to
the
object you specified."

**********************************
Public Function mSetForm(sParent As String, iPageCnt As Integer)

On Error GoTo Proc_Err
Dim i As Integer
Dim frm As Form
i = 0

Set frm = Forms![MyMainForm]

frm.subFrmPageTabs!txtPageCnt = iPageCnt

Proc_Exit:
Exit Function

Proc_Err:
MsgBox Err.Number & "; " & Err.Description
Resume Proc_Exit
End Function
************************************

The error occurs at the "frm.subFrmPageTabs!txtPageCnt = iPageCnt"
line.
I
have a subform called "subFrmPageTabs" on "MyMainForm" that has a
text
box
that I'm setting to a value. That's it. Have I not declared
something?
 
A

Allen Browne

That should work in Access 97 too.

Ask Access what the name of active control is:
? frm.subFrmPageTabs.Form.ActiveControl.Name

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

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

Craig said:
I apologize...I just realized too that I didn't make clear that I am using
Access 97.
--
Craig


Allen Browne said:
I take it that you worked down through the examples, and the previous
line
worked, i.e.:
? frm.subFrmPageTabs.Form.Name

If so, you have the correct reference to the form. So, if you replace
.Name
with !txtPageCnt and get the error, then txtPageCnt is not a valid name.

Craig said:
Well, I get the same error when I run the debug window at the "?
TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox" line...

For some reason, it just doesn't recognize the text box on the subform,
and
it's clearly there, typed correctly, etc.

--
Craig


:

Okay, to debug it:

1. Temporarily comment out the error handler, i.e.:
'On Error GoTo Proc_Err

2. Run the code. When it fails, it will stop at the problem line.
Chose Debug. We assume it will be this line:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

3. Open the Immediate Window (Ctrl+G), and ask Access to help you
debug
it.
Example questions:
? frm.Name
? TypeName(frm.subFrmPageTabs)
? frm.subFrmPageTabs.SourceObject
? frm.subFrmPageTabs.Form.Name
? TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox

That kind of thing should get you in touch with what's going on.

Thanks for the quick response Allen - however, I still get the same
error.
I'm sensing there may be corruption.

--
Craig


:

Try:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

A2003 is more pedantic about the .Form bit.

Explanation:
http://allenbrowne.com/casu-04.html

I'm modifying an app that was developed using Access 97. The
following
code
generates this error:

"2455: You entered an expression that has an invalid reference
to
the
property form/report. The property may not exist or may not
apply
to
the
object you specified."

**********************************
Public Function mSetForm(sParent As String, iPageCnt As Integer)

On Error GoTo Proc_Err
Dim i As Integer
Dim frm As Form
i = 0

Set frm = Forms![MyMainForm]

frm.subFrmPageTabs!txtPageCnt = iPageCnt

Proc_Exit:
Exit Function

Proc_Err:
MsgBox Err.Number & "; " & Err.Description
Resume Proc_Exit
End Function
************************************

The error occurs at the "frm.subFrmPageTabs!txtPageCnt =
iPageCnt"
line.
I
have a subform called "subFrmPageTabs" on "MyMainForm" that has a
text
box
that I'm setting to a value. That's it. Have I not declared
something?
 
C

Craig

Thanks for the response.

Doesn't like it. Same error (2455)
--
Craig


Allen Browne said:
That should work in Access 97 too.

Ask Access what the name of active control is:
? frm.subFrmPageTabs.Form.ActiveControl.Name

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

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

Craig said:
I apologize...I just realized too that I didn't make clear that I am using
Access 97.
--
Craig


Allen Browne said:
I take it that you worked down through the examples, and the previous
line
worked, i.e.:
? frm.subFrmPageTabs.Form.Name

If so, you have the correct reference to the form. So, if you replace
.Name
with !txtPageCnt and get the error, then txtPageCnt is not a valid name.

Well, I get the same error when I run the debug window at the "?
TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox" line...

For some reason, it just doesn't recognize the text box on the subform,
and
it's clearly there, typed correctly, etc.

--
Craig


:

Okay, to debug it:

1. Temporarily comment out the error handler, i.e.:
'On Error GoTo Proc_Err

2. Run the code. When it fails, it will stop at the problem line.
Chose Debug. We assume it will be this line:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

3. Open the Immediate Window (Ctrl+G), and ask Access to help you
debug
it.
Example questions:
? frm.Name
? TypeName(frm.subFrmPageTabs)
? frm.subFrmPageTabs.SourceObject
? frm.subFrmPageTabs.Form.Name
? TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox

That kind of thing should get you in touch with what's going on.

Thanks for the quick response Allen - however, I still get the same
error.
I'm sensing there may be corruption.

--
Craig


:

Try:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

A2003 is more pedantic about the .Form bit.

Explanation:
http://allenbrowne.com/casu-04.html

I'm modifying an app that was developed using Access 97. The
following
code
generates this error:

"2455: You entered an expression that has an invalid reference
to
the
property form/report. The property may not exist or may not
apply
to
the
object you specified."

**********************************
Public Function mSetForm(sParent As String, iPageCnt As Integer)

On Error GoTo Proc_Err
Dim i As Integer
Dim frm As Form
i = 0

Set frm = Forms![MyMainForm]

frm.subFrmPageTabs!txtPageCnt = iPageCnt

Proc_Exit:
Exit Function

Proc_Err:
MsgBox Err.Number & "; " & Err.Description
Resume Proc_Exit
End Function
************************************

The error occurs at the "frm.subFrmPageTabs!txtPageCnt =
iPageCnt"
line.
I
have a subform called "subFrmPageTabs" on "MyMainForm" that has a
text
box
that I'm setting to a value. That's it. Have I not declared
something?
 
A

Allen Browne

Craig, I don't know what else to suggest.

You say that Access reports the name of the form correctly with:
? frm.subFrmPageTabs.Form.Name
That should give the same result as:
? frm.subFrmPageTabs.SourceObject

If so, the form is loaded correctly.
Now presumably you are in Form View (or at least not in design view.)
Now you're saying this form has no ActiveControl at all?

If so, I'm starting to think you have a corrupt form.
Would you like instructions on how to get Access to recreate the form for
you?

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

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

Craig said:
Thanks for the response.

Doesn't like it. Same error (2455)
--
Craig


Allen Browne said:
That should work in Access 97 too.

Ask Access what the name of active control is:
? frm.subFrmPageTabs.Form.ActiveControl.Name

Craig said:
I apologize...I just realized too that I didn't make clear that I am
using
Access 97.
--
Craig


:

I take it that you worked down through the examples, and the previous
line
worked, i.e.:
? frm.subFrmPageTabs.Form.Name

If so, you have the correct reference to the form. So, if you replace
.Name
with !txtPageCnt and get the error, then txtPageCnt is not a valid
name.

Well, I get the same error when I run the debug window at the "?
TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox" line...

For some reason, it just doesn't recognize the text box on the
subform,
and
it's clearly there, typed correctly, etc.

--
Craig


:

Okay, to debug it:

1. Temporarily comment out the error handler, i.e.:
'On Error GoTo Proc_Err

2. Run the code. When it fails, it will stop at the problem line.
Chose Debug. We assume it will be this line:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

3. Open the Immediate Window (Ctrl+G), and ask Access to help you
debug
it.
Example questions:
? frm.Name
? TypeName(frm.subFrmPageTabs)
? frm.subFrmPageTabs.SourceObject
? frm.subFrmPageTabs.Form.Name
? TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox

That kind of thing should get you in touch with what's going on.

Thanks for the quick response Allen - however, I still get the
same
error.
I'm sensing there may be corruption.

--
Craig


:

Try:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

A2003 is more pedantic about the .Form bit.

Explanation:
http://allenbrowne.com/casu-04.html

I'm modifying an app that was developed using Access 97. The
following
code
generates this error:

"2455: You entered an expression that has an invalid
reference
to
the
property form/report. The property may not exist or may not
apply
to
the
object you specified."

**********************************
Public Function mSetForm(sParent As String, iPageCnt As
Integer)

On Error GoTo Proc_Err
Dim i As Integer
Dim frm As Form
i = 0

Set frm = Forms![MyMainForm]

frm.subFrmPageTabs!txtPageCnt = iPageCnt

Proc_Exit:
Exit Function

Proc_Err:
MsgBox Err.Number & "; " & Err.Description
Resume Proc_Exit
End Function
************************************

The error occurs at the "frm.subFrmPageTabs!txtPageCnt =
iPageCnt"
line.
I
have a subform called "subFrmPageTabs" on "MyMainForm" that
has a
text
box
that I'm setting to a value. That's it. Have I not declared
something?
 
C

Craig

Actually, "frm.subFrmPageTabs.Form.Name" doesn't work. If you remove the
"Form" to get "frm.subFrmPageTabs.Name" - that works. Likewise,
"?frm.subFrmPageTabs.SourceObject" works as well.

But "? frm.subFrmPageTabs.Form.ActiveControl.Name" returns the error.

Yes, your instructions/link to re-create the form would be helpful. And
again, thanks for your patience.
--
Craig


Allen Browne said:
Craig, I don't know what else to suggest.

You say that Access reports the name of the form correctly with:
? frm.subFrmPageTabs.Form.Name
That should give the same result as:
? frm.subFrmPageTabs.SourceObject

If so, the form is loaded correctly.
Now presumably you are in Form View (or at least not in design view.)
Now you're saying this form has no ActiveControl at all?

If so, I'm starting to think you have a corrupt form.
Would you like instructions on how to get Access to recreate the form for
you?

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

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

Craig said:
Thanks for the response.

Doesn't like it. Same error (2455)
--
Craig


Allen Browne said:
That should work in Access 97 too.

Ask Access what the name of active control is:
? frm.subFrmPageTabs.Form.ActiveControl.Name

I apologize...I just realized too that I didn't make clear that I am
using
Access 97.
--
Craig


:

I take it that you worked down through the examples, and the previous
line
worked, i.e.:
? frm.subFrmPageTabs.Form.Name

If so, you have the correct reference to the form. So, if you replace
.Name
with !txtPageCnt and get the error, then txtPageCnt is not a valid
name.

Well, I get the same error when I run the debug window at the "?
TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox" line...

For some reason, it just doesn't recognize the text box on the
subform,
and
it's clearly there, typed correctly, etc.

--
Craig


:

Okay, to debug it:

1. Temporarily comment out the error handler, i.e.:
'On Error GoTo Proc_Err

2. Run the code. When it fails, it will stop at the problem line.
Chose Debug. We assume it will be this line:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

3. Open the Immediate Window (Ctrl+G), and ask Access to help you
debug
it.
Example questions:
? frm.Name
? TypeName(frm.subFrmPageTabs)
? frm.subFrmPageTabs.SourceObject
? frm.subFrmPageTabs.Form.Name
? TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox

That kind of thing should get you in touch with what's going on.

Thanks for the quick response Allen - however, I still get the
same
error.
I'm sensing there may be corruption.

--
Craig


:

Try:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

A2003 is more pedantic about the .Form bit.

Explanation:
http://allenbrowne.com/casu-04.html

I'm modifying an app that was developed using Access 97. The
following
code
generates this error:

"2455: You entered an expression that has an invalid
reference
to
the
property form/report. The property may not exist or may not
apply
to
the
object you specified."

**********************************
Public Function mSetForm(sParent As String, iPageCnt As
Integer)

On Error GoTo Proc_Err
Dim i As Integer
Dim frm As Form
i = 0

Set frm = Forms![MyMainForm]

frm.subFrmPageTabs!txtPageCnt = iPageCnt

Proc_Exit:
Exit Function

Proc_Err:
MsgBox Err.Number & "; " & Err.Description
Resume Proc_Exit
End Function
************************************

The error occurs at the "frm.subFrmPageTabs!txtPageCnt =
iPageCnt"
line.
I
have a subform called "subFrmPageTabs" on "MyMainForm" that
has a
text
box
that I'm setting to a value. That's it. Have I not declared
something?
 
A

Allen Browne

Ah: now we have something more concrete.

You have something named subFrmPageTabs.
Did you try:
? TypeName(frm.subFrmPageTabs)
Does this return the same as acSubform?
If so, you have a subform control named subFrmPageTabs.

At this point, you do not have a reference to the form *in* the subform
control.

Try:
? frm.subFrmPageTabs.SourceObject
Does this return the name of the form that is supposed to be in the subform
control?

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

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

Craig said:
Actually, "frm.subFrmPageTabs.Form.Name" doesn't work. If you remove the
"Form" to get "frm.subFrmPageTabs.Name" - that works. Likewise,
"?frm.subFrmPageTabs.SourceObject" works as well.

But "? frm.subFrmPageTabs.Form.ActiveControl.Name" returns the error.

Yes, your instructions/link to re-create the form would be helpful. And
again, thanks for your patience.
--
Craig


Allen Browne said:
Craig, I don't know what else to suggest.

You say that Access reports the name of the form correctly with:
? frm.subFrmPageTabs.Form.Name
That should give the same result as:
? frm.subFrmPageTabs.SourceObject

If so, the form is loaded correctly.
Now presumably you are in Form View (or at least not in design view.)
Now you're saying this form has no ActiveControl at all?

If so, I'm starting to think you have a corrupt form.
Would you like instructions on how to get Access to recreate the form for
you?

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

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

Craig said:
Thanks for the response.

Doesn't like it. Same error (2455)
--
Craig


:

That should work in Access 97 too.

Ask Access what the name of active control is:
? frm.subFrmPageTabs.Form.ActiveControl.Name

I apologize...I just realized too that I didn't make clear that I am
using
Access 97.
--
Craig


:

I take it that you worked down through the examples, and the
previous
line
worked, i.e.:
? frm.subFrmPageTabs.Form.Name

If so, you have the correct reference to the form. So, if you
replace
.Name
with !txtPageCnt and get the error, then txtPageCnt is not a valid
name.

Well, I get the same error when I run the debug window at the "?
TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox" line...

For some reason, it just doesn't recognize the text box on the
subform,
and
it's clearly there, typed correctly, etc.

--
Craig


:

Okay, to debug it:

1. Temporarily comment out the error handler, i.e.:
'On Error GoTo Proc_Err

2. Run the code. When it fails, it will stop at the problem
line.
Chose Debug. We assume it will be this line:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

3. Open the Immediate Window (Ctrl+G), and ask Access to help
you
debug
it.
Example questions:
? frm.Name
? TypeName(frm.subFrmPageTabs)
? frm.subFrmPageTabs.SourceObject
? frm.subFrmPageTabs.Form.Name
? TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox

That kind of thing should get you in touch with what's going on.

Thanks for the quick response Allen - however, I still get the
same
error.
I'm sensing there may be corruption.

--
Craig


:

Try:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

A2003 is more pedantic about the .Form bit.

Explanation:
http://allenbrowne.com/casu-04.html

I'm modifying an app that was developed using Access 97.
The
following
code
generates this error:

"2455: You entered an expression that has an invalid
reference
to
the
property form/report. The property may not exist or may
not
apply
to
the
object you specified."

**********************************
Public Function mSetForm(sParent As String, iPageCnt As
Integer)

On Error GoTo Proc_Err
Dim i As Integer
Dim frm As Form
i = 0

Set frm = Forms![MyMainForm]

frm.subFrmPageTabs!txtPageCnt = iPageCnt

Proc_Exit:
Exit Function

Proc_Err:
MsgBox Err.Number & "; " & Err.Description
Resume Proc_Exit
End Function
************************************

The error occurs at the "frm.subFrmPageTabs!txtPageCnt =
iPageCnt"
line.
I
have a subform called "subFrmPageTabs" on "MyMainForm" that
has a
text
box
that I'm setting to a value. That's it. Have I not
declared
something?
 
C

Craig

"? frm.subFrmPageTabs.SourceObject" returns "subFrmPageTabs"

Yes, the txtPageCnt is on a subform, ie., Mainform.Subform.txtPagecnt

--
Craig


Allen Browne said:
Ah: now we have something more concrete.

You have something named subFrmPageTabs.
Did you try:
? TypeName(frm.subFrmPageTabs)
Does this return the same as acSubform?
If so, you have a subform control named subFrmPageTabs.

At this point, you do not have a reference to the form *in* the subform
control.

Try:
? frm.subFrmPageTabs.SourceObject
Does this return the name of the form that is supposed to be in the subform
control?

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

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

Craig said:
Actually, "frm.subFrmPageTabs.Form.Name" doesn't work. If you remove the
"Form" to get "frm.subFrmPageTabs.Name" - that works. Likewise,
"?frm.subFrmPageTabs.SourceObject" works as well.

But "? frm.subFrmPageTabs.Form.ActiveControl.Name" returns the error.

Yes, your instructions/link to re-create the form would be helpful. And
again, thanks for your patience.
--
Craig


Allen Browne said:
Craig, I don't know what else to suggest.

You say that Access reports the name of the form correctly with:
? frm.subFrmPageTabs.Form.Name
That should give the same result as:
? frm.subFrmPageTabs.SourceObject

If so, the form is loaded correctly.
Now presumably you are in Form View (or at least not in design view.)
Now you're saying this form has no ActiveControl at all?

If so, I'm starting to think you have a corrupt form.
Would you like instructions on how to get Access to recreate the form for
you?

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

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

Thanks for the response.

Doesn't like it. Same error (2455)
--
Craig


:

That should work in Access 97 too.

Ask Access what the name of active control is:
? frm.subFrmPageTabs.Form.ActiveControl.Name

I apologize...I just realized too that I didn't make clear that I am
using
Access 97.
--
Craig


:

I take it that you worked down through the examples, and the
previous
line
worked, i.e.:
? frm.subFrmPageTabs.Form.Name

If so, you have the correct reference to the form. So, if you
replace
.Name
with !txtPageCnt and get the error, then txtPageCnt is not a valid
name.

Well, I get the same error when I run the debug window at the "?
TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox" line...

For some reason, it just doesn't recognize the text box on the
subform,
and
it's clearly there, typed correctly, etc.

--
Craig


:

Okay, to debug it:

1. Temporarily comment out the error handler, i.e.:
'On Error GoTo Proc_Err

2. Run the code. When it fails, it will stop at the problem
line.
Chose Debug. We assume it will be this line:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

3. Open the Immediate Window (Ctrl+G), and ask Access to help
you
debug
it.
Example questions:
? frm.Name
? TypeName(frm.subFrmPageTabs)
? frm.subFrmPageTabs.SourceObject
? frm.subFrmPageTabs.Form.Name
? TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox

That kind of thing should get you in touch with what's going on.

Thanks for the quick response Allen - however, I still get the
same
error.
I'm sensing there may be corruption.

--
Craig


:

Try:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

A2003 is more pedantic about the .Form bit.

Explanation:
http://allenbrowne.com/casu-04.html

I'm modifying an app that was developed using Access 97.
The
following
code
generates this error:

"2455: You entered an expression that has an invalid
reference
to
the
property form/report. The property may not exist or may
not
apply
to
the
object you specified."

**********************************
Public Function mSetForm(sParent As String, iPageCnt As
Integer)

On Error GoTo Proc_Err
Dim i As Integer
Dim frm As Form
i = 0

Set frm = Forms![MyMainForm]

frm.subFrmPageTabs!txtPageCnt = iPageCnt

Proc_Exit:
Exit Function

Proc_Err:
MsgBox Err.Number & "; " & Err.Description
Resume Proc_Exit
End Function
************************************

The error occurs at the "frm.subFrmPageTabs!txtPageCnt =
iPageCnt"
line.
I
have a subform called "subFrmPageTabs" on "MyMainForm" that
has a
text
box
that I'm setting to a value. That's it. Have I not
declared
something?
 
A

Allen Browne

Well, not I'm stuck again.

If this works:
? frm.subFrmPageTabs.SourceObject
and you are in Form view (not design view),
and you can see the subform in the main form,
and you do actually have a form named subFrmPageTabs,
and frm is referring to the main form,
then the form is loaded into the subform control.

So:
? frm.subFrmPageTabs.Form
will refer to the form in the subform control, and so:
? frm.subFrmPageTabs.Form.Name
will return the name of that form.

Not sure what else I can say.

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

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

Craig said:
"? frm.subFrmPageTabs.SourceObject" returns "subFrmPageTabs"

Yes, the txtPageCnt is on a subform, ie., Mainform.Subform.txtPagecnt

--
Craig


Allen Browne said:
Ah: now we have something more concrete.

You have something named subFrmPageTabs.
Did you try:
? TypeName(frm.subFrmPageTabs)
Does this return the same as acSubform?
If so, you have a subform control named subFrmPageTabs.

At this point, you do not have a reference to the form *in* the subform
control.

Try:
? frm.subFrmPageTabs.SourceObject
Does this return the name of the form that is supposed to be in the
subform
control?

Craig said:
Actually, "frm.subFrmPageTabs.Form.Name" doesn't work. If you remove
the
"Form" to get "frm.subFrmPageTabs.Name" - that works. Likewise,
"?frm.subFrmPageTabs.SourceObject" works as well.

But "? frm.subFrmPageTabs.Form.ActiveControl.Name" returns the error.

Yes, your instructions/link to re-create the form would be helpful.
And
again, thanks for your patience.
--
Craig


:

Craig, I don't know what else to suggest.

You say that Access reports the name of the form correctly with:
? frm.subFrmPageTabs.Form.Name
That should give the same result as:
? frm.subFrmPageTabs.SourceObject

If so, the form is loaded correctly.
Now presumably you are in Form View (or at least not in design view.)
Now you're saying this form has no ActiveControl at all?

If so, I'm starting to think you have a corrupt form.
Would you like instructions on how to get Access to recreate the form
for
you?

Thanks for the response.

Doesn't like it. Same error (2455)
--
Craig


:

That should work in Access 97 too.

Ask Access what the name of active control is:
? frm.subFrmPageTabs.Form.ActiveControl.Name

I apologize...I just realized too that I didn't make clear that I
am
using
Access 97.
--
Craig


:

I take it that you worked down through the examples, and the
previous
line
worked, i.e.:
? frm.subFrmPageTabs.Form.Name

If so, you have the correct reference to the form. So, if you
replace
.Name
with !txtPageCnt and get the error, then txtPageCnt is not a
valid
name.

Well, I get the same error when I run the debug window at the
"?
TypeName(frm.subFrmPageTabs.Form!txtPageCnt) = acTextBox"
line...

For some reason, it just doesn't recognize the text box on the
subform,
and
it's clearly there, typed correctly, etc.

--
Craig


:

Okay, to debug it:

1. Temporarily comment out the error handler, i.e.:
'On Error GoTo Proc_Err

2. Run the code. When it fails, it will stop at the problem
line.
Chose Debug. We assume it will be this line:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

3. Open the Immediate Window (Ctrl+G), and ask Access to help
you
debug
it.
Example questions:
? frm.Name
? TypeName(frm.subFrmPageTabs)
? frm.subFrmPageTabs.SourceObject
? frm.subFrmPageTabs.Form.Name
? TypeName(frm.subFrmPageTabs.Form!txtPageCnt) =
acTextBox

That kind of thing should get you in touch with what's going
on.

Thanks for the quick response Allen - however, I still get
the
same
error.
I'm sensing there may be corruption.

--
Craig


:

Try:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

A2003 is more pedantic about the .Form bit.

Explanation:
http://allenbrowne.com/casu-04.html

I'm modifying an app that was developed using Access 97.
The
following
code
generates this error:

"2455: You entered an expression that has an invalid
reference
to
the
property form/report. The property may not exist or may
not
apply
to
the
object you specified."

**********************************
Public Function mSetForm(sParent As String, iPageCnt As
Integer)

On Error GoTo Proc_Err
Dim i As Integer
Dim frm As Form
i = 0

Set frm = Forms![MyMainForm]

frm.subFrmPageTabs!txtPageCnt = iPageCnt

Proc_Exit:
Exit Function

Proc_Err:
MsgBox Err.Number & "; " & Err.Description
Resume Proc_Exit
End Function
************************************

The error occurs at the "frm.subFrmPageTabs!txtPageCnt =
iPageCnt"
line.
I
have a subform called "subFrmPageTabs" on "MyMainForm"
that
has a
text
box
that I'm setting to a value. That's it. Have I not
declared
something?
 
D

David W. Fenton

Try:
frm.subFrmPageTabs.Form!txtPageCnt = iPageCnt

A2003 is more pedantic about the .Form bit.

I know of no post-A95 that didn't require the .Form if you were
referring to the form and not the control.
 
D

David W. Fenton

Well, not I'm stuck again.

If this works:
? frm.subFrmPageTabs.SourceObject
and you are in Form view (not design view),
and you can see the subform in the main form,
and you do actually have a form named subFrmPageTabs,
and frm is referring to the main form,
then the form is loaded into the subform control.

So:
? frm.subFrmPageTabs.Form
will refer to the form in the subform control, and so:
? frm.subFrmPageTabs.Form.Name
will return the name of that form.

Not sure what else I can say.

There are runtime circumstances in A97 that I've never been able to
pin down that cause Access to not be able to recognize a subform.
It's often an issue of navigation between records in the parent form
or requerying of the child form. I have not found any single cause
and usually have to futz around with the order of operations to get
it to work.
 
M

Marshall Barton

Allen said:
Well, not I'm stuck again.

If this works:
? frm.subFrmPageTabs.SourceObject
and you are in Form view (not design view),
and you can see the subform in the main form,
and you do actually have a form named subFrmPageTabs,
and frm is referring to the main form,
then the form is loaded into the subform control.

So:
? frm.subFrmPageTabs.Form
will refer to the form in the subform control, and so:
? frm.subFrmPageTabs.Form.Name
will return the name of that form.

Not sure what else I can say.


Allen, I don't see if it has been established where/when
this code is executed. Wouldn't that error be expected if
the code is executed from the main form's Open, Load or
(first) Current event?
 
D

Dirk Goldgar

In
David W. Fenton said:
I know of no post-A95 that didn't require the .Form if you were
referring to the form and not the control.

This works in Access 97, Access 2000, and Access 2002:

Forms!MainFormName!SubformName!ControlNameOnSubform

If you use the bang to refer to the controls, rather than the dot, you
can leave out the ".Form".
 

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