473,387 Members | 1,290 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Sub-SubForm Reference Problem

I've got a form (frmDeal) that has a subform (frmDeal_Tranche) that has a
subform (frmDeal_TrancheCusip).

When I try to refer to properties on the "Cusip" form at the end of the chain,
MS Access is throwing "2455: Expression has invalid reference to Property
Form/Report"
In an Immediate window:
------------------------------------------
?me.Name
frmDeal

?me.subTranche.Form.Name
frmDeal_Tranche

?me.subTranche.Form!subCusips.name
subCusips

?me.subTranche.Form!subCusips.SourceObject
frmDeal_TrancheCusip

?me.subTranche.Form!SubCusips.Form.name
("2455: Expression has invalid reference to Property Form/Report")
------------------------------------------

Am I trying to push MS Access to far?

Or am I just doing something simple-and-dumb?
--
PeteCresswell
Sep 3 '06 #1
14 3290
rkc
(PeteCresswell) wrote:
I've got a form (frmDeal) that has a subform (frmDeal_Tranche) that has a
subform (frmDeal_TrancheCusip).

When I try to refer to properties on the "Cusip" form at the end of the chain,
MS Access is throwing "2455: Expression has invalid reference to Property
Form/Report"
In an Immediate window:
------------------------------------------
?me.Name
frmDeal

?me.subTranche.Form.Name
frmDeal_Tranche

?me.subTranche.Form!subCusips.name
subCusips

?me.subTranche.Form!subCusips.SourceObject
frmDeal_TrancheCusip

?me.subTranche.Form!SubCusips.Form.name
("2455: Expression has invalid reference to Property Form/Report")
------------------------------------------

Am I trying to push MS Access to far?

Or am I just doing something simple-and-dumb?
Aside from the fact that I don't see how you are getting
a reference to the form in the immediate window so that
Me works at all, that should work.

You are already as deep with the forth call as you are
going with the fifth as far as subForms go. As far as
objects go DAO is deeper than that.

Have you tried Mr. Fairfield's recommendation of
skipping dotting your way through the hierarchy
and just using: Form_frmDeal_TrancheCusip.Name?


Sep 3 '06 #2
On Sun, 03 Sep 2006 14:28:21 -0400, "(PeteCresswell)" <x@y.Invalid>
wrote:
>I've got a form (frmDeal) that has a subform (frmDeal_Tranche) that has a
subform (frmDeal_TrancheCusip).

When I try to refer to properties on the "Cusip" form at the end of the chain,
MS Access is throwing "2455: Expression has invalid reference to Property
Form/Report"
In an Immediate window:
------------------------------------------
?me.Name
frmDeal

?me.subTranche.Form.Name
frmDeal_Tranche

?me.subTranche.Form!subCusips.name
subCusips

?me.subTranche.Form!subCusips.SourceObject
frmDeal_TrancheCusip

?me.subTranche.Form!SubCusips.Form.name
("2455: Expression has invalid reference to Property Form/Report")
------------------------------------------

Am I trying to push MS Access to far?

Or am I just doing something simple-and-dumb?
Perhaps it's something version specific? I just ran this in my
immediate window with Access 2000:
?me.Name
frmDeal

?me.subTranche.Form.Name
frmDeal_Tranche

?me.subTranche.Form!subCusips.name
subCusips

?me.subTranche.Form!subCusips.SourceObject
frmDeal_TrancheCusip

?me.subTranche.Form!SubCusips.Form.name
frmDeal_TrancheCusip
-=-=-=-=-=-=-=-=-=-=-=-=
Randy Harris
tech at promail dot com
Sep 3 '06 #3
Per rkc:
>Aside from the fact that I don't see how you are getting
a reference to the form in the immediate window so that
Me works at all, that should work.
I stopped the code during the process of loading the form.

Good catch. I'll go back and try to replicate it from outside of the form -
knowing that if there are no records behind a .RecordSource that MS Access can
throw an error something like (not sure if it's exactly the same) the one I
posted.
--
PeteCresswell
Sep 3 '06 #4
Per (PeteCresswell):
I'll go back and try to replicate it from outside of the form -
Nope: same results

viz:
------------------------------
?forms!frmDeal!subTranche.Form!subCusips.Sourceobj ect
frmDeal_TrancheCusip

?forms!frmDeal!subTranche.Form!subCusips.Form.name
(2455)
------------------------------
Also two more observations:
-------------------------------------------------------
1) When I just plow through all errors in the rest
of the form's processing, the 2455 pops in several
other bits of code - each digging down to that subform.
So I doubt it's just a typo.

2) If I start the subform up by itself, all my reference trials
in Immediate work.
e.g.
. . . . . . . . . . . . . . . .
?forms!frmDeal_TrancheCusip.name
frmDeal_TrancheCusip

?forms!frmDeal_TrancheCusip.recordsource
ttblDealCache_TrancheCusip
. . . . . . . . . . . . . . . .
-------------------------------------------------------

I'm starting to think in terms of just working around this
with some sort of Grid or TreeView control.
--
PeteCresswell
Sep 3 '06 #5
On Sun, 03 Sep 2006 20:35:41 GMT, Randy Harris <ra***@no.spam.net>
wrote:
>On Sun, 03 Sep 2006 14:28:21 -0400, "(PeteCresswell)" <x@y.Invalid>
wrote:
>>I've got a form (frmDeal) that has a subform (frmDeal_Tranche) that has a
subform (frmDeal_TrancheCusip).

When I try to refer to properties on the "Cusip" form at the end of the chain,
MS Access is throwing "2455: Expression has invalid reference to Property
Form/Report"
In an Immediate window:
------------------------------------------
?me.Name
frmDeal

?me.subTranche.Form.Name
frmDeal_Tranche

?me.subTranche.Form!subCusips.name
subCusips

?me.subTranche.Form!subCusips.SourceObject
frmDeal_TrancheCusip

?me.subTranche.Form!SubCusips.Form.name
("2455: Expression has invalid reference to Property Form/Report")
------------------------------------------

Am I trying to push MS Access to far?

Or am I just doing something simple-and-dumb?

Perhaps it's something version specific? I just ran this in my
immediate window with Access 2000:
?me.Name
frmDeal

?me.subTranche.Form.Name
frmDeal_Tranche

?me.subTranche.Form!subCusips.name
subCusips

?me.subTranche.Form!subCusips.SourceObject
frmDeal_TrancheCusip

?me.subTranche.Form!SubCusips.Form.name
frmDeal_TrancheCusip
-=-=-=-=-=-=-=-=-=-=-=-=
Randy Harris
tech at promail dot com
I thought that knowing that it was not a syntax error or an Access
limitation would be of some help. That's why I tested it and posted
the results.
Sep 4 '06 #6
Per Randy Harris:
>I thought that knowing that it was not a syntax error or an Access
limitation would be of some help. That's why I tested it and posted
the results.
That took some time/effort. Thanks!
--
PeteCresswell
Sep 4 '06 #7
Per (PeteCresswell):
>>I thought that knowing that it was not a syntax error or an Access
limitation would be of some help. That's why I tested it and posted
the results.

That took some time/effort. Thanks!

I just replicated it. First on my home office machine, then on the client's
machine. Works A-OK for me too - with a little "playpen" db created for the
purpose. Even works when I import the three nested forms into the "real" app.

I guess now I'm down to:
------------------------------------------------------------------------------
1) Something so dumb/obvious that I'm missing it in the "real" implementation.

2) Some kind of corruption weirdness in the "real" app.
------------------------------------------------------------------------------
--
PeteCresswell
Sep 4 '06 #8
Per (PeteCresswell):
>I guess now I'm down to:
------------------------------------------------------------------------------
1) Something so dumb/obvious that I'm missing it in the "real" implementation.

2) Some kind of corruption weirdness in the "real" app.
------------------------------------------------------------------------------

I think I'm on to something.

The reference works ok if there is no .Recordset in the immediate parent.

The reference works ok if the .Recordset in the immediate parent contains one or
more records.

The reference fails if the .Recordset of the immediate parent is empty!

VIZ:
--------------------------------------------------------------------------------
forms!frmDeal!subTranche.form.recordsource = "ttblDealCache_Tranche" (1 record)
?forms!frmDeal!subTranche.Form!subCusips.form.name
frmDeal_TrancheCusip

forms!frmDeal!subTranche.form.recordsource = ""
?forms!frmDeal!subTranche.Form!subCusips.form.name
frmDeal_TrancheCusip

forms!frmDeal!subTranche.form.recordsource = "ttblDealCache_Tranche" (empty)
?forms!frmDeal!subTranche.Form!subCusips.form.name
(Error 2455)
--------------------------------------------------------------------------------
I'd put that in the category of "weirdnesses".....

--
PeteCresswell
Sep 4 '06 #9
"(PeteCresswell)" <x@y.Invalidwrote in
news:a2********************************@4ax.com:
Per rkc:
>>Aside from the fact that I don't see how you are getting
a reference to the form in the immediate window so that
Me works at all, that should work.

I stopped the code during the process of loading the form.

Good catch. I'll go back and try to replicate it from outside of
the form - knowing that if there are no records behind a
.RecordSource that MS Access can throw an error something like
(not sure if it's exactly the same) the one I posted.
I experienced that exact problem recently, trying to refer to a
control on a subform when the parent form had no records. In that
situation, the subform control exists, but the subform does not (the
subform was unbound, so its recordsource didn't matter).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Sep 4 '06 #10
"(PeteCresswell)" <x@y.Invalidwrote in
news:s2********************************@4ax.com:
The reference fails if the .Recordset of the immediate parent is
empty!
This is the exact same error I encountered a couple of weeks ago,
and posted about here (all on one line, of course):

http://groups.google.com/group/comp..../msg/e9e5a1d17
d4ff92f

It was exactly the same problem. The subform control exists on a
form with no records, but the subform *in* that control does *not*
exist.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Sep 4 '06 #11
Per David W. Fenton:
>It was exactly the same problem. The subform control exists on a
form with no records, but the subform *in* that control does *not*
exist.
Did you come up with a workaround?

I'm thinking a front-end-resident dummy table with one empty record in it. Set
..RecordSource to that dummy table before any of the problem code fires, then set
it back to the "real" .RecordSource afterwards.
--
PeteCresswell
Sep 5 '06 #12
"(PeteCresswell)" <x@y.Invalidwrote in
news:r5********************************@4ax.com:
Per David W. Fenton:
>>It was exactly the same problem. The subform control exists on a
form with no records, but the subform *in* that control does *not*
exist.

Did you come up with a workaround?
In my case, I just moved my subform reference to after a requery, so
that there were records.
I'm thinking a front-end-resident dummy table with one empty record
in it. Set
.RecordSource to that dummy table before any of the problem code
fires, then set
it back to the "real" .RecordSource afterwards.
Setting the form to allow additions should give you at least one
record. You can disable the control so the user can't type until
they've initiated a legal add.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Sep 5 '06 #13
Per David W. Fenton:
>Setting the form to allow additions should give you at least one
record. You can disable the control so the user can't type until
they've initiated a legal add.
You mean disabling the subform control that has the offending form as it's
..SourceObject, right?

I never would have thought of that - and it sounds like the simplest
solution.... even to the point of implementing across all of my forms/subforms
because occurrence of the problem would seem tb data-dependent and therefore
lurking in other forms/subforms. i.e. avoiding it depends on a given subform
having records behind it..

Thanks.
--
PeteCresswell
Sep 5 '06 #14
"(PeteCresswell)" <x@y.Invalidwrote in
news:pl********************************@4ax.com:
Per David W. Fenton:
>>Setting the form to allow additions should give you at least one
record. You can disable the control so the user can't type until
they've initiated a legal add.

You mean disabling the subform control that has the offending form
as it's .SourceObject, right?
That's probably the way I'd do it, though others might disable the
controls on the form.
I never would have thought of that - and it sounds like the
simplest solution.... even to the point of implementing across all
of my forms/subforms because occurrence of the problem would seem
tb data-dependent and therefore lurking in other forms/subforms.
i.e. avoiding it depends on a given subform having records
behind it..
I'm surprised you haven't encountered this often enough before to
have hit on this solution before.

Another solution is setting the recordsource to something that
returns one Null record. I do this a lot in forms that I want to
open with no records loaded. The basic method is to do a SELECT TOP
1 on the table with the least records, and make all the fields Null,
something like this:

SELECT TOP 1 Null As FirstField, Null As SecondField
FROM [table]

The result is that your bound controls all show Null, are uneditable
and you have only one record, and you don't have to worry about
setting AllowAdditions.

I've never done it in a subform, though -- only in a parent form.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Sep 5 '06 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: tshad | last post by:
I have an example I copied from "programming asp.net" (o'reilly) and can't seem to get the Sub (writefile) to execute. It displays all the response.write lines that are called directly, but not...
5
by: Colleyville Alan | last post by:
I have a sub that can do two different tasks based on the value of one variable. So I'd like to have two different buttons on the same form run this, but each one setting a flag so that the...
3
by: Kathy Burke | last post by:
Hi, I'm tired, so this question may be silly. I have a fairly long sub procedure. Based on one condition, I load another sub with the following: If Session("GRN") = "complete" Then txtScan.Text...
10
by: tmaster | last post by:
When I try to dynamically add a second sub menu item to this ContextMenu item, I get an error 'Specified argument was out of the range of valid values'. Private Sub mnuTopics_Show_Select(ByVal...
12
by: Ron | last post by:
Greetings, I am trying to understand the rational for Raising Events instead of just calling a sub. Could someone explain the difference between the following 2 scenarios? Why would I want to...
4
by: dbuchanan | last post by:
Is the following behavior normal? Both the 'Protected sub' in the inherited form and the 'Private Shadows sub' in the derived form fires. My interpretation of MSDN help on the topic "Shadows"...
7
by: ILCSP | last post by:
Hi, I'm using VB.Net (2003) and I have a question. Does anyone knows how to call a procedure using a variable? The variable will be equal to the name of the procedure. for example, if I have...
5
by: Sharon | last post by:
Hi all. To prevent access to a sub system internal types, is it necessary to create the sub system in a different project, and use the internal access level? Or is there another way that will...
6
by: Bob | last post by:
Hi, I found this code here below (about cartitems and shoppingcart) and I have two questions about sub New(). In the first class CartItem, there is two times sub New(): Public Sub New() End...
6
by: Thom Little | last post by:
Using C# 3.5 I have a form that calls many other sub-forms. Typically there will be five forms open at the same time. If the main form is closed all the sub forms are also closed. Is there...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.