473,396 Members | 2,068 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,396 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 1191
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.