472,341 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Cannot update Label Caption on Subform from inside another subform?

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
4 4895
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
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
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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Pavan Arise | last post by:
Hi all.. This may seem simple..but I am stuck here! I have a frame in which I have a label. I was trying to change the caption of that label via...
3
by: Joshua Ammann | last post by:
Hi, (Using Access 2000) I have two tables, similar to Customers and Orders. (Not an exact parallel, but works for this example.) On a form...
1
by: Darn | last post by:
Hi all How do i solve this problem. I'm web developer from Malaysia, the problem occurs when i ftp an Access database which i'm using for this...
2
by: webbi | last post by:
I have a text box called txtAttirubte1 and an update button in FormA. I want to update the label caption for all label name Attribute1_Lable in...
4
by: MrDeej | last post by:
Hello guys! I have a masterform "kg" and a subform "kg varelinjer" (order and order details in english) In the subform i have a field named...
1
by: zion | last post by:
Hello, How can I change label caption on page load ? Thanks
4
by: Annie Bender | last post by:
Wow, I finally got through my first VB "tutorial" project and everything works nice, except one userform label caption will only display as long as...
1
by: jonkillua | last post by:
hi guys, i'm creating a program that instead of using the print method to display the odd/even numbers, i want to display the result in...
1
by: BranX | last post by:
I have a label on a worksheet. When I press a button on the same worksheet, the program should set the new label caption and do some other...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

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.