473,466 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to update a label caption in other forms in MS Access

2 New Member
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 FormB and FormC with the WORD I type in the FormA text box, txtAttribute1. I have the following codes for the ON CLICK event of Update button on FormA.

Private Sub cmdUpdate_Click()
DoCmd.OpenForm "frm_FormB"
[Forms]![ frm_FormB]![Attribute1_Label].Caption = Me![txtAttirubte1].Value
DoCmd.Close acForm, frm_FormB, acSavePrompt

DoCmd.OpenForm "frm_FormC"
[Forms]![ frm_FormC]![Attribute1_Label].Caption = Me![txtAttirubte1].Value
DoCmd.Close acForm, frm_FormC, acSavePrompt
End Sub

However, it doesn’t work. Please help. Many thanks!

Webbi
Apr 2 '07 #1
2 14803
Missionary
30 New Member
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 FormB and FormC with the WORD I type in the FormA text box, txtAttribute1. I have the following codes for the ON CLICK event of Update button on FormA.

Private Sub cmdUpdate_Click()
DoCmd.OpenForm "frm_FormB"
[Forms]![ frm_FormB]![Attribute1_Label].Caption = Me![txtAttirubte1].Value
DoCmd.Close acForm, frm_FormB, acSavePrompt

DoCmd.OpenForm "frm_FormC"
[Forms]![ frm_FormC]![Attribute1_Label].Caption = Me![txtAttirubte1].Value
DoCmd.Close acForm, frm_FormC, acSavePrompt
End Sub

However, it doesn’t work. Please help. Many thanks!

Webbi
An easy way to do this is to make a macro.
open frm_FormB
SetValue Item: [Forms]![ frm_FormB]![Attribute1_Label].caption
Expression: [Forms]![ frm_FormA]![Attribute1_Label].
Close Type: Form
Name: frm_FormB
Save: Prompt
open frm_FormC
SetValue Item: [Forms]![ frm_FormC]![Attribute1_Label].caption
Expression: [Forms]![ frm_FormA]![Attribute1_Label].
Close Type: Form
Name: frm_FormC
Save: Prompt

Set your update button to run the macro.
Feb 20 '08 #2
jaxjagfan
254 Recognized Expert Contributor
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 FormB and FormC with the WORD I type in the FormA text box, txtAttribute1. I have the following codes for the ON CLICK event of Update button on FormA.

Private Sub cmdUpdate_Click()
DoCmd.OpenForm "frm_FormB"
[Forms]![ frm_FormB]![Attribute1_Label].Caption = Me![txtAttirubte1].Value
DoCmd.Close acForm, frm_FormB, acSavePrompt

DoCmd.OpenForm "frm_FormC"
[Forms]![ frm_FormC]![Attribute1_Label].Caption = Me![txtAttirubte1].Value
DoCmd.Close acForm, frm_FormC, acSavePrompt
End Sub

However, it doesn’t work. Please help. Many thanks!

Webbi
Normally values are only available to a single form for use within that form for its functions and not available outside of that form. We need to make the value (In your case a string from FormA) a public value for use thru-out the app.

If you have a Module in your database add a public variable. If no module then add one.

Public vlbl as variant

On the AfterUpdate Property of txtAttirubte1 on FormA.

vlbl = Me.txtAttirubte1

On the OnLoad events of FormB and FormC

Me.Attribute1_Label.Caption = vlbl

Just remember next time you come into the app that the labels will go back to there default values.
Feb 20 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Mark | last post by:
How do you reference the caption of the label attached to a control on a form by first referencing the form? For example, textbox named Addr1 has an attached label with the caption "Address1"....
7
by: Jared | last post by:
Here is my situation. I have multiple labels on a form but only certain ones will become visible while using the form. Depending on which check box(s) you pick, on another form, determines the...
4
by: Paul T. Rong | last post by:
Hello there, I have tried all day but in vain....here is the problem: Form1: there are 50 labels (so far, the number is subject to change), each label caption is a fruit or a vegetable, for...
5
by: MLH | last post by:
This is one for you gurus. Someone has undoubtedly already done this. How difficult would it be to recurse all command buttons and textbox controls on all forms, appending an incrementing number to...
6
by: Joe | last post by:
I know that the Literal control will not render a <span> tag so I can not format its text. Other than this, what is the difference betwen the Literal control and the LiteralControl Control? How...
4
by: Ryan | last post by:
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 =...
8
by: =?Utf-8?B?R3JlZyBMYXJzZW4=?= | last post by:
I'm trying to figure out how to modify a panel (panel1) from a backgroundworker thread. But can't get the panel to show the new controls added by the backgroundwork task. Here is my code. In...
4
by: Henrootje | last post by:
I have a REPORT with in it a subFORM Now I have this label (lblMonth) that I want to change. How should I do this? What would be the proper event to do this? The lblMonth should contain the...
11
by: Apple001 | last post by:
I am having trouble using SQL UPDATE statement in VBA. I have: Forms: -"frmClaim": Main form. Data is based on table "claim." It has ClaimID, and other fields. ClaimID is the auto number and...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.