472,958 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Can you add a string inside a record without deleting its previous value

I want to add a new string inside a cell without deleting its previous value. The goal is one asset is part of multiple kits like a resistor. So i need a cell inside resistor asset with multiple value like (kit 1, kit 2, kit 3).

Question:
If I add a new kit with a resistor asset, i have to update that cell inside resistor asset. But when i do a update query it replaces the current value of that cell to the value of 'Update to' inside the query.
Oct 24 '15 #1

✓ answered by zmbd

1) It is not considered best practice to store multiple values within a single field. Instead, one should create a normalized database structure. >> Database Normalization and Table Structures.

2)However, there are legitimate instances where one may need to append values to the current value in a field.
Generic for a static value:
Expand|Select|Wrap|Line Numbers
  1. UPDATE [TableName]
  2. SET [FieldName]=[FieldName]+'appendedvalue'
  3. WHERE (criteria);
One can get fancier using SELECT and Sub queries to build the final string between tables and then update the third. Once again, if one is needing to do this then it generally indicates a flaw in the original table structures and relationships. ((I say generally because there are times where one needs to de-normalize for reports or other specialized situations. Even then I tend to use a VBA function such as this one Function fConcatChild to build the string on the fly from the normalized data. ))


On a side note:
To store data/information:
Excel/spreadsheets use "Cells"
Access/databases use Tables>Records>Fields. :)

2 1166
zmbd
5,501 Expert Mod 4TB
1) It is not considered best practice to store multiple values within a single field. Instead, one should create a normalized database structure. >> Database Normalization and Table Structures.

2)However, there are legitimate instances where one may need to append values to the current value in a field.
Generic for a static value:
Expand|Select|Wrap|Line Numbers
  1. UPDATE [TableName]
  2. SET [FieldName]=[FieldName]+'appendedvalue'
  3. WHERE (criteria);
One can get fancier using SELECT and Sub queries to build the final string between tables and then update the third. Once again, if one is needing to do this then it generally indicates a flaw in the original table structures and relationships. ((I say generally because there are times where one needs to de-normalize for reports or other specialized situations. Even then I tend to use a VBA function such as this one Function fConcatChild to build the string on the fly from the normalized data. ))


On a side note:
To store data/information:
Excel/spreadsheets use "Cells"
Access/databases use Tables>Records>Fields. :)
Oct 25 '15 #2
hvsummer
215 128KB
we can update info into 1 records without delete old value by copy that value first, adding info to it then insert it back into table again, can be done via VBA.

I think zmbd did give the best solution via SQL, but you will need some tweak with JOIN, ORDER BY, WHERE to resolve your problem.
Oct 25 '15 #3

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

Similar topics

10
by: MLH | last post by:
I have an A97 table with a Yes/No field named TowJob and a form bound to that table. The TowJob control on the form is bound to the same field. It is an option group with Yes and No bttns valued...
2
by: tdmailbox | last post by:
I had some code that returns a random record for a recordset. It works fine unless my record set has one value. So as a solution I tried to wrap the whole thing inside an If statement so that it...
1
by: Blake Versiga | last post by:
When editing a datagrid (C#) I need to know if the user changed the value of cell AND what the previous value was. Is this possible? If so how do I get the previous value or at least if the...
4
by: Michael Yanowitz | last post by:
Hello: If I have a long string (such as a Python file). I search for a sub-string in that string and find it. Is there a way to determine if that found sub-string is inside single-quotes or...
1
by: eusko | last post by:
for example vec = new int; then we input the values of vector elements if we decided to change the vector size, is it possible to do it without deleting the existing values of the vector...
12
by: djmauro | last post by:
as title says. I cant find a way to do this. if i use form1.show and click on a button. it opens that form, but as soon as i click again it just reopens it and closes previously opened form. So is...
2
by: David Jackson | last post by:
Hello, I'm using VS.NET 2005. I have a ListView populated with data pulled from a SQL Server database. I have wired up a SelectedIndexChanged event, but I can't find any way of retrieving...
3
by: Ross Ferguson | last post by:
I need to build a query on one table using a field in a current record and the same field in the previous record. Essentially, I need to know the difference between the value in the current record...
7
by: sai manoj bandi | last post by:
using c++ in files: when using ios::out mode for an old file,which is to be changed once again,(not only at the end),the old information in the file is getting deleted.what operation should we use...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.