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

Cannot update Label Caption on Subform from inside another subform?

P: n/a
I've got a little bit of code that runs when you enter data in a
datasheet view (which is a subform of the form you are in)

if rst!DateReceived >= 30 Then
Forms!DisposalRecords.Label90.Caption = (Date - rst!DateReceived) &
" Days"
however, when that runs to update the caption, it says that it cannot
find form DisposalRecords

I've also tried.

Me.Parent.DisposalRecords.Label90.Caption

I've tried
[Forms_Disposal].DisposalRecords.Label90.Caption (Where Disposal is
the parent form of DisposalRecords).

I've even tried [Forms]![DisposalRecords]![Label90].Caption ..

They all give me the same thing, or similar. Cannot find Form
"DisposalRecords"...

However, anything that's in the parent form (to the second subform)
can update it.. but if it's in the first Child (First Subform).. trying
to update the Second Subform of the parent, it bails out on me.

I hope this makes sense. I'm new to working with Access.. and more
specifically we are using Access 97.

Nov 22 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
See if this link help.
Refer to Form and Subform properties and controls
http://www.mvps.org/access/forms/frm0031.htm

Ryan wrote:
>I've got a little bit of code that runs when you enter data in a
datasheet view (which is a subform of the form you are in)

if rst!DateReceived >= 30 Then
Forms!DisposalRecords.Label90.Caption = (Date - rst!DateReceived) &
" Days"

however, when that runs to update the caption, it says that it cannot
find form DisposalRecords

I've also tried.

Me.Parent.DisposalRecords.Label90.Caption

I've tried
[Forms_Disposal].DisposalRecords.Label90.Caption (Where Disposal is
the parent form of DisposalRecords).

I've even tried [Forms]![DisposalRecords]![Label90].Caption ..

They all give me the same thing, or similar. Cannot find Form
"DisposalRecords"...

However, anything that's in the parent form (to the second subform)
can update it.. but if it's in the first Child (First Subform).. trying
to update the Second Subform of the parent, it bails out on me.

I hope this makes sense. I'm new to working with Access.. and more
specifically we are using Access 97.
--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200611/1

Nov 23 '06 #2

P: n/a
Thanks..

But I dont see one that fits what I'm doing unless I'm mistaken.

Main Form
| |
Sub1 Sub2

I want Sub1 to update something on the main form that ultimately is
from Sub2. It's just a label caption.

Not sure if that little 'ascii' diagram will come through once
formatting gets ahold of this thread.
ruralguy via AccessMonster.com wrote:
See if this link help.
Refer to Form and Subform properties and controls
http://www.mvps.org/access/forms/frm0031.htm

Ryan wrote:
I've got a little bit of code that runs when you enter data in a
datasheet view (which is a subform of the form you are in)

if rst!DateReceived >= 30 Then
Forms!DisposalRecords.Label90.Caption = (Date - rst!DateReceived) &
" Days"

however, when that runs to update the caption, it says that it cannot
find form DisposalRecords

I've also tried.

Me.Parent.DisposalRecords.Label90.Caption

I've tried
[Forms_Disposal].DisposalRecords.Label90.Caption (Where Disposal is
the parent form of DisposalRecords).

I've even tried [Forms]![DisposalRecords]![Label90].Caption ..

They all give me the same thing, or similar. Cannot find Form
"DisposalRecords"...

However, anything that's in the parent form (to the second subform)
can update it.. but if it's in the first Child (First Subform).. trying
to update the Second Subform of the parent, it bails out on me.

I hope this makes sense. I'm new to working with Access.. and more
specifically we are using Access 97.

--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200611/1
Nov 27 '06 #3

P: n/a
A SubForm can reference the MainForm in two way: through the Forms collection
or directly using Me.Parent.

Forms!MainFormName!ControlName

or

Me.Parent.ControlName

...using your form and control names of course.

Ryan wrote:
>Thanks..

But I dont see one that fits what I'm doing unless I'm mistaken.

Main Form
| |
Sub1 Sub2

I want Sub1 to update something on the main form that ultimately is
from Sub2. It's just a label caption.

Not sure if that little 'ascii' diagram will come through once
formatting gets ahold of this thread.
>See if this link help.
Refer to Form and Subform properties and controls
[quoted text clipped - 36 lines]
>Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200611/1
--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via http://www.accessmonster.com

Nov 27 '06 #4

P: n/a

Ryan wrote:
I've got a little bit of code that runs when you enter data in a
datasheet view (which is a subform of the form you are in)

if rst!DateReceived >= 30 Then
Forms!DisposalRecords.Label90.Caption = (Date - rst!DateReceived) &
" Days"
however, when that runs to update the caption, it says that it cannot
find form DisposalRecords

I've also tried.

Me.Parent.DisposalRecords.Label90.Caption

I've tried
[Forms_Disposal].DisposalRecords.Label90.Caption (Where Disposal is
the parent form of DisposalRecords).

I've even tried [Forms]![DisposalRecords]![Label90].Caption ..

They all give me the same thing, or similar. Cannot find Form
"DisposalRecords"...

However, anything that's in the parent form (to the second subform)
can update it.. but if it's in the first Child (First Subform).. trying
to update the Second Subform of the parent, it bails out on me.

I hope this makes sense. I'm new to working with Access.. and more
specifically we are using Access 97.
You should be able to use either of the the following from the first
child subform:

[Forms_Disposal].DisposalRecords.Form!Label90.Caption
Me.Parent.DisposalRecords.Form!Label90.Caption

In either case note that you must reference the Form property of the
subform object (DisposalRecords) to get to the underlying controls in
your subforms. I always make it a habit to rename my subforms
fsubFormName to remind me that they are subform controls, not actual
form objects embedded in another form.

HTH,
Bruce

Nov 27 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.