473,394 Members | 1,738 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,394 software developers and data experts.

Updating A Text String In A Text Field With An Update Query

If I have the following string in a text field of a table:
"This is a test"
can I create an update query that will change, say, the string "is" to
"xyz" in the two locations where it occurs or would this require VBA?
Thanks,
Sheldon Potolsky
Jun 27 '08 #1
3 6570
Use an Update query.

Something like this:
UPDATE Table1
SET [F1] = Replace([F1], "is", "xyz")
WHERE [F1] Like "*is*";

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Sheldon" <SH********@aol.comwrote in message
news:61**********************************@y38g2000 hsy.googlegroups.com...
If I have the following string in a text field of a table:
"This is a test"
can I create an update query that will change, say, the string "is" to
"xyz" in the two locations where it occurs or would this require VBA?
Thanks,
Sheldon Potolsky
Jun 27 '08 #2
Thank you Allen; that worked great.

As a followup, if I also wanted to change all occurrences of "t" or
"T" to "123" in the string "This is a test", would I need an
additional query? In my real world example, I'm trying to remove
certain strings such as "<br/>" and "&nbsp;" whenever they occur in a
closing description of a problem.

Thank you, Sheldon
>
Something like this:
* * UPDATE Table1
* * SET [F1] = Replace([F1], "is", "xyz")
* * WHERE [F1] Like "*is*";

--
Allen Browne - Microsoft MVP. *Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Sheldon" <SHPsalm...@aol.comwrote in message

news:61**********************************@y38g2000 hsy.googlegroups.com...
If I have the following string in a text field of a table:
"This is a test"
can I create an update query that will change, say, the string "is" to
"xyz" in the two locations where it occurs or would this require VBA?
Thanks,
Sheldon Potolsky- Hide quoted text -

- Show quoted text -
Jun 27 '08 #3
Yes: execute an Update query for each replacement.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Sheldon" <SH********@aol.comwrote in message
news:95**********************************@i76g2000 hsf.googlegroups.com...
Thank you Allen; that worked great.

As a followup, if I also wanted to change all occurrences of "t" or
"T" to "123" in the string "This is a test", would I need an
additional query? In my real world example, I'm trying to remove
certain strings such as "<br/>" and "&nbsp;" whenever they occur in a
closing description of a problem.

Thank you, Sheldon
>
Something like this:
UPDATE Table1
SET [F1] = Replace([F1], "is", "xyz")
WHERE [F1] Like "*is*";

"Sheldon" <SHPsalm...@aol.comwrote in message

news:61**********************************@y38g2000 hsy.googlegroups.com...
If I have the following string in a text field of a table:
"This is a test"
can I create an update query that will change, say, the string "is" to
"xyz" in the two locations where it occurs or would this require VBA?
Thanks,
Sheldon Potolsky- Hide quoted text -

- Show quoted text -
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
1
by: Harry Devine | last post by:
I have a DataGrid that is configured to use the Edit/Update/Cancel concept correctly. My grid shows values from 5 database fields. I only need to update that last 4 fields. The last field is a...
3
by: Jon Agiato | last post by:
Hi, I am trying to use a data grid in a web application in which I have three tiers. The DataGrid is not set up to a data source, or a data adapter, so everytime I make a change I send the cell...
5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
8
by: Chris A via AccessMonster.com | last post by:
I have an interesting problem that I have yet to come accross that I can't change data structure on because it is an export from filemaker I am reformatting for another dept. anyway. I have a table...
5
by: JimmyKoolPantz | last post by:
Situation: I am writing a program that opens up a data file (file ext .dbf), imports the information into a dataset. The program also, searches through the dataset for key words ("company...
15
by: sara | last post by:
I have a Memo field in a table to hold notes from a conversation a social worker has had with a client (this is for a non-profit). If the user needs to update the memo field, I need to find the...
10
by: chimambo | last post by:
Hi All, I have a little problem. I am retrieving records from a table and I want to update the records using checkboxes. I am able to display the database record quite alright and I have created...
2
by: Marcin Wiszowaty | last post by:
im using asp and vs03 vb but i understand some c# im trying to make a checkbox's checked (true|false) value update a sqlserver 2000 table. the db type for that field is bit. and i would...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.