473,320 Members | 1,991 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Update multiple text box names at once

I have an Access database form that has 160 text boxes that the name needs to be updated every year. The name is looks like "xxxxxx2015" "xxxxxx2014" and continues. Each year you have to go in and update the year at the end of each text box name. Is there a way to have it update the name in the text box based on what is entered in another box?
Nov 2 '15 #1
12 3170
Rabbit
12,516 Expert Mod 8TB
You should redesign your database do you don't have to do this at all. First normalize the tables do you don't have a new table every year. Second, use column names that aren't date specific so that you don't have to keep renaming them.
Nov 2 '15 #2
The data changes every year so we have a "new" database each year so when needed we can go back to the conditions of a certain year.
Nov 3 '15 #3
Rabbit
12,516 Expert Mod 8TB
Data changes, but not the fields. There's no need to do any of that if you just add a year column to the table.
Nov 3 '15 #4
For us it does. The rules of how a certain piece of data is used changes year to year. Sometimes we need to run it under the old rules. But thank you for the suggestion.
Nov 3 '15 #5
zmbd
5,501 Expert Mod 4TB
SSH1223
Rabbit is usually right about these things and it may prove very helpful if you will take a few moments to look thru the insights article covering Normalization and table design (read here).

When you say "Text Boxes" what is it that you are referring to:
The label for the text box... this is the static text
Or the control that shows the actual data....

I am guessing the label is what you are referring to and that can be done by altering the caption property of the control via VBA.

Once again, I could not agree more with Rabbit's first post about restructuring your database to eliminate the need to do this every year.

Now as for your data analysis issues.
I work in a ISO9001 certified lab and I have yet to find any reason not to normalize the databases. Raw data collected at one point in time is analyzed using one method and yet at another point in time is analyzed using a different method pr reported in one unit of measurement the first time and a different unit the second time. Even different customers require different units or methods of testing. All of this is handled by proper associations within the table structures.

If you are willing to start a new thread and are willing to describe to us the general nature of your data set and the rules, we may be able to give you some general pointers on how to normalize your data set.
Nov 4 '15 #6
Rabbit
12,516 Expert Mod 8TB
The rules of how a certain piece of data is used changes year to year. Sometimes we need to run it under the old rules.
Without knowing the exact specifications of these rules you are referring to, let me just say generally that it is much easier to add a couple of lines of code to account for time based rules than it is to completely change the structure every year.
Nov 4 '15 #7
Thank you for the input on normalizing the database; however, What I was looking for was a way to use VBA or a macro to update the form. The field I am trying to update is the name field in the property sheet. I was hoping there would be a way to have that field on all the text boxes to update when I update one.
Nov 4 '15 #8
Rabbit
12,516 Expert Mod 8TB
We understand what you're trying to accomplish for the most part. What I'm trying to point out is that you're taking a less efficient path.

We have a duty to at least try to steer you to the correct path first. But if you'd rather continue on your current path, you can loop through the controls array on the form to do your renaming.
Nov 4 '15 #9
zmbd
5,501 Expert Mod 4TB
I believe that the form will have to be opened in design-view first, you can do that with the VBA call.
This will not work for "executable" (*.acdbe) or runtime only versions of the database, this will work only within the full Access application.
Nov 5 '15 #10
MikeTheBike
639 Expert 512MB
Hi

Could I ask a question.

When you change the name of each textbox do the number of textbox and/or their position on the from/report change?

The name of a control Textbox) is not directly connected to the name of the field connected to it (only by default in Access' wizard).

Therefore, if you just name the control as xxxxx1, xxxxx2, xxxxx3, .... etc. you can programmatically loop through the control and change their ControlSource to the relevant Field for the year in question.

I have used this technique on a 12 month rolling year report based on a crosstab query (trickey enough on is own). In this instance I do not know the order of the month in the query or the starting and ending month when the form is designed and code written.

At run time I loop through the month labels and textbox control assigning the Months (based on month ending selection) to the labels and the relevant query field name to the textbox ControlSources in the correct chronological order.

Of course the Query/RecordSource fields and the code must be compatible.

Sorry this is a bit verbose, but I hope it gives some clue to what I am trying to say.

In a nutshell I am trying to say that the control name is not that significant.

Not sure if that is any help hear, but it may provoke some thoughts.

MTB
Nov 5 '15 #11
When you change the name of each textbox do the number of textbox and/or their position on the from/report change?

No the position on the form doesn't change. This sounds similiar to what I was looking for. Something to loop through and change the control source to the new year.
Nov 5 '15 #12
zmbd
5,501 Expert Mod 4TB


I know it seems trivial; however, we seem to be using textbox and labels interchangeably and they quite simply are not the same. Perhaps it's the Chemist in me that insists on proper nomenclature ;)

However,

+ In one instance we seem to be talking about the labels and changing their captions

+ In the next we seem to be talking about changing names

+ Now we appear to be talking about the control source... which textbox controls have; however, labels do not have such a property, furthermore, changing the name of the control has nothing to do with either the caption of the label nor the controlsource of the textbox.

So, SSH1223, which type of control are you talking about?

SSH1223. if you will normalize your database, you could filter the recordsource based on a textbox/combobox/listbox-control and apply the proper formula/business model to the data.

Furthermore, if the data uses the same fields, then one should only need to change the form's record source not the individual controls, unless you've "hard coded" them into their control sources, other than the captions in the labels.
Attached Images
File Type: jpg 964695_multiplecontrolrenames.jpg (92.9 KB, 1187 views)
Nov 6 '15 #13

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

Similar topics

1
by: A P | last post by:
How can I go about updating multiple records or deleting multiple records from a DB at a time?
3
by: Wim Verhavert | last post by:
Hi all, I'm bothered with this question for weeks now.... Is it possible to edit multiple records at once using VBA? I have this continuous form and depending on the selection the user makes, I...
1
by: CS | last post by:
I need to update multiple tables from one form using a command button. The info from the different text boxes should then go into the tables. Can someone help me with some example code on how to...
1
by: DR | last post by:
Is it possible to update multiple solutions on the server at once? The group I am working with, created a web application that will be recreated as a copy for each new customer with new DB....
2
by: xntric | last post by:
Hi, I have a form with multiple text boxes. In the text boxes i have grey font with default values to show an example for users. Is there a way to code the form to automatically change a textbox...
10
by: alcstudio | last post by:
Hello there i wonder how the update string should look if i want to update multiple posts at same time. Iam looping out all post from a table like this: set recsettraktamente =...
7
by: =?Utf-8?B?Sm9lIFRob21wc29u?= | last post by:
Hi, I have a C# windows form application (.NET 2.0) that reads data over the serial port and displays the data via textboxes. I get a message 50 times/second. I know I can't update the screen...
11
by: TechnoAtif | last post by:
INSERT AND UPDATE MULTIPLE CHECKBOX DATA USING PHPMYSQL OR JAVASCRIPT Hi All I want to check the multiple checkboxes update them after revisiting that page. I am taking the name as...
7
by: CoachDave48 | last post by:
I am a rookie coder and got some great help from Marcus last year so I thought I would make another request. I am trying to retrieve all boys in one household into a form and edit the individual...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.