Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

2455 Invalid reference to property Form - Why doesn't this work?

4 views
Skip to first unread message

tonyv

unread,
Jul 17, 2009, 12:38:36 AM7/17/09
to
Ok this is driving me nuts. In code I am attempting to set the Row
Source
Property of a control on the second subform On Open of the main form.
I keep getting the "2455 invalid reference to the property Form/
Report"

Here is my attempt in relation to being on the current main form
Me!PlacementsSubform.Form!MonitoringSubform.Form!Con_ID.RowSource =
"..."


Also I attempted to reference it explicitly
Forms!frm_Positions!PlacementsSubform.Form!MonitoringSubform.Form!
Con_ID.RowSource = "..."


I got my syntax from the Access Web - http://www.mvps.org/access/forms/frm0031.htm.
I am referencing the subform's CONTROL name and not their Source
Objects. The control Con_ID is the correct name and it is a combo
box.


Your help is appreciated
Tony

Dirk Goldgar

unread,
Jul 17, 2009, 12:50:49 PM7/17/09
to
"tonyv" wrote in message
news:8998c14c-c6c7-42a1...@24g2000yqm.googlegroups.com...


That syntax looks right to me. Am I right in understanding that the
subforms are nested, so that MonitoringSubform is a subform control on the
form represented by PlacementsSubform, which is a subform control on the
main form, which is the form that is executing the code? "frm_Positions" is
the name of that main form?

Try this as a debugging procedure in the Immediate window:

DoCmd.OpenForm "frm_Positions"

?Forms!frm_Positions!PlacementsSubform.SourceObject
(should display the name of the form represented by
PlacementsSubform)

?Forms!frm_Positions!PlacementsSubform.Form!MonitoringSubform.SourceObject
(should display the name of the form represented by
MonitoringSubform)

?Forms!frm_Positions!PlacementsSubform.Form!MonitoringSubform.Form!Con_ID
(should display the current value of Con_ID -- maybe Null)

If any of those statements gives an error, that should point to where the
problem lies. If none of them gives an error, then either the main form's
Open event is too soon for some reason, or maybe you are doing something
like assigning a subform's SourceObject in the Open, Load, or Currrent event
of its parent. Only you can say if you're doing that.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

tonyv

unread,
Jul 17, 2009, 3:26:05 PM7/17/09
to
Thanks for the sugestion! I will try it out on Monday when I will be
working on this project again and let you know if that doesn't lead me
to a resolution.

Tony

On Jul 17, 11:50 am, "Dirk Goldgar"

> (please reply to the newsgroup)- Hide quoted text -
>
> - Show quoted text -

tonyv

unread,
Jul 20, 2009, 5:44:12 PM7/20/09
to
Well I ran your suggested tests and they all return the expected falue
except the last one.
?Forms!frm_Positions!PlacementsSubform.Form!MonitoringSubform.Form!
Con_ID

I checked the control and Con_ID is in fact its name and the name of
the field it is bound to. I checked the underlying SQl to make sure it
is pulling the correct field and it is. It is a combo box and I set
the column width to show the first column so I can confirm it is
displaying data. I just can't set the reference it in any way.

I tried changing the control name thinking that it was conflicting
with the field name but that made no difference (I didn't expect it
to)

I can find no other code attempting call or modify that control in any
way pon open, load, current or any other event.

I checked that I don't have any missing references.

ARRGH! Access gods, what am I doing wrong!

[heavy sigh]

I do vaguely remember a similar problem I had a long time ago in a
version 2000 database where I had to set focus on controls 'down the
ladder' so to speak - to get access to be able to reference a control
in subform 2. I don't know if that is what is going on here and I
don't remember if I had to setfocus on the subform controls themselves
or control on the subforms or some combination. If that rings a bell
to you maybe you know the correct syntax to get that done.
Unfortunately I don't have that database areound anymore to reference
it.

Thanks for your help so far. Any other suggestions?

Tony

On Jul 17, 11:50 am, "Dirk Goldgar"
<d...@NOdataSPAMgnostics.com.invalid> wrote:

tonyv

unread,
Jul 21, 2009, 9:59:13 AM7/21/09
to
Ok I did some further testing. I whipped up a test database, created
tables and forms for Customers, Orders and OrdersDetails. I set some
OnOpen code to set teh value of some text boxes on the main form to
equal various values and properties of subforms and their controls.
They all worked find. Here is what I used

Me.Text4 = Me.OrdersSubform.SourceObject
Me.Text6 = Me!OrdersSubform.Form!OrderType
Me.Text8 = Me!OrdersSubform.Form!OrdersDetailsSubform.SourceObject
Me.Text10 = Me!OrdersSubform.Form!
OrdersDetailsSubform.Form.RecordSource
Me.Text12 = Me!OrdersSubform.Form!OrdersDetailsSubform.Form!
ProductNumber
Me.Text14 = Me!OrdersSubform.Form!OrdersDetailsSubform.Form!
ProductNumber.RowSource

For the offending database I imported all objects into a new MDB
thinking there was some corruption. No go.

I am sick of beating my head against a wall so for now I will set the
JobID to a public variable, set the timer interval on subform2 to 1
second and on the first timer event if the control's rowsource is
blank then set it referring to the public varable in the SQL criteria.
I tested and so far that works.

Thanks
Tony


On Jul 20, 4:44 pm, tonyv <t...@stamperssidekick.com> wrote:
<refer to previous posts>

Dirk Goldgar

unread,
Jul 22, 2009, 9:38:55 AM7/22/09
to

Though I'll understand if you want to just forget about this, I'm curious.
If you'd like to send me a cut-down copy of your database, containing only
the elements necessary to demonstrate the problem, compacted and then zipped
to less than 1MB in size (preferably much smaller) -- I'll have a look at
it, time permitting. You can send it to the address derived by removing NO
SPAM and ".invalid" from the reply address of this message. If that address
isn't visible to you, you can get my address from my web site, which is
listed in my sig. Do *not* post my real address in the newsgroup -- I don't
want to be buried in spam and viruses.

--

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


"tonyv" wrote in message
news:07d3a712-b0df-488e...@b15g2000yqd.googlegroups.com...

tonyv

unread,
Jul 22, 2009, 5:32:25 PM7/22/09
to
On its way. Thanks

Tony

On Jul 22, 8:38 am, "Dirk Goldgar"

0 new messages