By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,667 Members | 2,261 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,667 IT Pros & Developers. It's quick & easy.

Trying To Reference SubForm: "2467 Object closed or does not exist"?

P: n/a
I've got a parent form and three subforms.

Two of them work A-OK.

For the third one, in the Immediate window:
-----------------------------------------
?Me.subDeal.Name
subDeal

?Me.subDeal.SourceObject
frmDeal_Deal

?Me.subDeal.RecordSource
2467 - Object closed or does not exist
-----------------------------------------

So it seems like it sort of exists, but doesn't exist.... depending on what
props I try to get to.

Tried SaveAsText and then LoadFromText, but nothing changed.

I recall similar situations years ago and hazily recall that in one of them it
was something to with not having any records behind the subform... but I've got
a dummy table there... (I think.... because I can't check it in Immediate or
in code).

Anybody been here?
--
PeteCresswell
Jul 14 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Per (PeteCresswell):
>So it seems like it sort of exists, but doesn't exist.... depending on what
props I try to get to.
Oh yeah... and all 3 subforms are in separate tabs on a Tab control... and
there's also a Tree control on the form.
--
PeteCresswell
Jul 15 '06 #2

P: n/a
On Fri, 14 Jul 2006 20:03:24 -0400, "(PeteCresswell)" <x@y.Invalidwrote:
>I've got a parent form and three subforms.

Two of them work A-OK.

For the third one, in the Immediate window:
-----------------------------------------
?Me.subDeal.Name
subDeal

?Me.subDeal.SourceObject
frmDeal_Deal

?Me.subDeal.RecordSource
2467 - Object closed or does not exist
-----------------------------------------
?Me.subDeal.Form.Recordsource

Recordsource is a property of the form contained in the subform control, not of
the subform control itself.

Me.subDeal.Name and Me.subDeal.SourceObject work because they are referring to
properties of the subform control itself.
>
So it seems like it sort of exists, but doesn't exist.... depending on what
props I try to get to.

Tried SaveAsText and then LoadFromText, but nothing changed.

I recall similar situations years ago and hazily recall that in one of them it
was something to with not having any records behind the subform... but I've got
a dummy table there... (I think.... because I can't check it in Immediate or
in code).

Anybody been here?
Wayne Gillespie
Gosford NSW Australia
Jul 15 '06 #3

P: n/a
Per Wayne Gillespie:
>?Me.subDeal.Form.Recordsource

Recordsource is a property of the form contained in the subform control, not of
the subform control itself.
I mis-typed in the post.

Here's a Copy/Paste from the actual VBA:
---------------------------------------------
9020 With Me
9021 .subDeal.Form.RecordSource = ""
9022 .subMetrics.Form.RecordSource = ""
9023 .subPaymentHistory.Form.RecordSource = ""
9024 .subPriceHistory.Form.RecordSource = ""
9025 .subTranche.Form.RecordSource = ""
9029 End With

9030 WorkTable_Create "ttblDealCache_Deal", "zmtblDealCache_Deal"
9031 WorkTable_Create "ttblDealCache_MetricHistory",
"zmtblDealCache_MetricHistory"
9032 WorkTable_Create "ttblDealCache_PaymentHistory",
"zmtblDealCache_PaymentHistory"
9033 WorkTable_Create "ttblDealCache_PriceHistory",
"zmtblDealCache_PriceHistory"
9034 WorkTable_Create "ttblDealCache_Tranche", "zmtblDealCache_Tranche"
9039 WorkTable_Create "ttblDealCache_TrancheFund", "zmtblDealCache_TrancheFund"

9040 With Me
9041 .subDeal.Form.RecordSource = "ttblDealCache_Deal"
9042 .subMetrics.Form.RecordSource = "qryDeal_MetricHistory"
9043 .subPaymentHistory.Form.RecordSource = "qryDeal_PaymentHistory"
9044 .subPriceHistory.Form.RecordSource = "qryDeal_PriceHistory"
9045 .subTranche.Form.RecordSource = "qryDeal_Tranche"
9049 End With
---------------------------------------------

To me, the puzzler is why .subDeal fails and the other four work.

I *know* I've been here before but cannot remember what the cause was.
--
PeteCresswell
Jul 15 '06 #4

P: n/a
On Sat, 15 Jul 2006 12:33:25 -0400, "(PeteCresswell)" <x@y.Invalidwrote:
>Per Wayne Gillespie:
>>?Me.subDeal.Form.Recordsource

Recordsource is a property of the form contained in the subform control, not of
the subform control itself.

I mis-typed in the post.

Here's a Copy/Paste from the actual VBA:
---------------------------------------------
9020 With Me
9021 .subDeal.Form.RecordSource = ""
9022 .subMetrics.Form.RecordSource = ""
9023 .subPaymentHistory.Form.RecordSource = ""
9024 .subPriceHistory.Form.RecordSource = ""
9025 .subTranche.Form.RecordSource = ""
9029 End With

9030 WorkTable_Create "ttblDealCache_Deal", "zmtblDealCache_Deal"
9031 WorkTable_Create "ttblDealCache_MetricHistory",
"zmtblDealCache_MetricHistory"
9032 WorkTable_Create "ttblDealCache_PaymentHistory",
"zmtblDealCache_PaymentHistory"
9033 WorkTable_Create "ttblDealCache_PriceHistory",
"zmtblDealCache_PriceHistory"
9034 WorkTable_Create "ttblDealCache_Tranche", "zmtblDealCache_Tranche"
9039 WorkTable_Create "ttblDealCache_TrancheFund", "zmtblDealCache_TrancheFund"

9040 With Me
9041 .subDeal.Form.RecordSource = "ttblDealCache_Deal"
9042 .subMetrics.Form.RecordSource = "qryDeal_MetricHistory"
9043 .subPaymentHistory.Form.RecordSource = "qryDeal_PaymentHistory"
9044 .subPriceHistory.Form.RecordSource = "qryDeal_PriceHistory"
9045 .subTranche.Form.RecordSource = "qryDeal_Tranche"
9049 End With
---------------------------------------------

To me, the puzzler is why .subDeal fails and the other four work.

I *know* I've been here before but cannot remember what the cause was.
Have you tried making the recordsource of .subDeal a query instead of the table?
I have no idea why this would make a difference, but it is the only difference I
can see between the 5 calls.
Wayne Gillespie
Gosford NSW Australia
Jul 15 '06 #5

P: n/a
Per Wayne Gillespie:
>
Have you tried making the recordsource of .subDeal a query instead of the table?
I have no idea why this would make a difference, but it is the only difference I
can see between the 5 calls.
I resisted the temptation for awhile - but now that you've said it too, gave it
a try. No-go.

What I did do, however, was completely rebuild the form from scratch and guess
what?.... All problems magically went away.

I copied the VBA code from the old form to the new form, didn't rebuild the
subforms, but did create all objects in the new form from scratch.

Now that I've done it, I'm positive that I went through this at least once -
maybe twice - some years ago. Same scenario: parent form with a TreeView
control and several subforms... goofy stuff with semi-existing Form objects on
the subs... and a couple of other things. I even found some notes in an old app
about the TreeView acting strange if the form it resided on didn't have a
..RecordSet....

For now, I'll put my money on MS's TreeView control (MSComctlLib.TreeCtrl.2). It
definitely acts goofey at times in other ways... and I suspect it's a little
shaky.
--
PeteCresswell
Jul 15 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.