Solved

how to change label name dynamically

Posted on 2009-05-06
7
732 Views
Last Modified: 2013-11-29
Hi everyone:
I have noticed that Access does not change the label name dynamically. Is there a way of changing the label name in the form without going to the form and typing in.
for example: at first, I created a field name "what is your age" and later on I change it to "age" from the table. on my form only the source control got changed not the label.
I have a bush of changes coming in in this project and I really want to find a way to make those changes without going through the form. thanks for your suggestions
0
Comment
Question by:LougaLo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 85
ID: 24316065
Do you mean the lable that's associated with your control? If so, why is it important to change the name? You may have good reasons for doing this, but unless you've got code that interacts with your labels then the names aren't really important.

That said, Rick Fishers Find & Replace utility could help with this (www.rickworld.com).
0
 

Author Comment

by:LougaLo
ID: 24317054
LSMConsulting:

thanks for your prompt response.
I installed the shareware "Find and Replace 9.0 for Microsoft Access 2000, 2002/XP, 2003" but this is not doing the real change I needed . it is changing just the Source Control not the label linked to the source control nor the field name on the table. I sent an email to the website support exposing my need and requesting if this is possible through their product. otherwise it looks like a great Add-on and affordable too.

I come from a FileMaker world. In filemaker when I change  a field name on a table definition, it got changed in the form too without me going and hard coding the label name. I wonder if this is possible in Access.
0
 
LVL 16

Expert Comment

by:Chuck Wood
ID: 24318533
I think you mean the label Captions. Normally, you wouldn't do this. You generally design the tables first and, when that is done, create the forms bound to the tables. That said, I have attached a (really clunky) work-around code snippet that should do what you want. Of course this will only work for bound text boxes. Combo boxes, for example would have Control Sources different (and larger) than their label captions (e.g. SELECT ID, Deparment FROM tblDepartments).

Please let me know if you have any questions.
Private Sub Form_Load()
    ' set the label captions to their text box control source (field) name
    lblManager.Caption = txtManager.ControlSource
    lblDepartment.Caption = txtDepartment.ControlSource
    ' . . .
End Sub

Open in new window

0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 85
ID: 24319204
I see ... this doesn't happen in Access. cwood has shown you how this can be done with code, but it's not automatic when you make table changes.
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 250 total points
ID: 24323438
LougaLo,

As has been stated, Access, (nor any other program that I know of) will not do this for you "automatically"
The reason being that the "Label Caption" is what "Humans" need to see.
The other names are typically what the program reads internally.
Also, typically you will have your naming convetion in place that will supercede any default name.

Since the "Label Caption" is what "Human Beings" will be using, your field might be "cFN" or "WhatIsYourName", but the label caption will say "Customer First Name" or "What is your Name"
Make sense?
;-)

Also keep in mind that the Name of the "Filed" and the name of the "Control" may be different as well.

For example:
Field Name: FN
Label Name: lblFN
Label Caption: First Name
TextBox Name: txtFN
TextBox ControlSource (Source Field): FN

This follow a "Naming Convention".
Every developer should follow some sort of Naming convention.
Here are the two most popular for Access/VBA:
LNC:
http://en.wikipedia.org/wiki/Leszynski_naming_convention
RVBA:
http://www.xoc.net/standards/default.asp

Please consider adopting one.
;-)

As far as changing them en masse goes, here is one of the popular "Bulk Renaming" products:
http://www.rickworld.com/products.html

;-)


JeffCoachman
0
 

Author Comment

by:LougaLo
ID: 24358860
cwood-wm-com: this codes do not allow change when it done through the table definition.

boag2000: you made valid points. the links were very helpful.

thank you all.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24360373
Thanks

Jeff
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question