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

How to Find and Replace a value in a field using 2 Textboxes

547 512MB
I have two text boxes in a form:
Old_Value
New_Value

I want to use the recordset method or whatever is the best, to replace multiple rows (in tblClientmeds) based on the "Old_Value" textbox (FIND) , with a value in the "New_Value" Textbox (REPLACE) using VBA.
My table - tblClientmeds
My field - IdNo

Any suggestions?
May 12 '13 #1

✓ answered by Seth Schrock

If Old_Value contains the exact value you are searching for and New_Value contains the entire text you want stored, then an update query would be easiest. Based on the field name of IdNo, I'm going to guess that it is a number field. So the query would be close to this:
Expand|Select|Wrap|Line Numbers
  1. UPDATE tblClientmeds SET IdNo = Forms!your_form!New_Value
  2. WHERE IdNo = Forms!your_form!Old_Value

3 1163
Seth Schrock
2,965 Expert 2GB
If Old_Value contains the exact value you are searching for and New_Value contains the entire text you want stored, then an update query would be easiest. Based on the field name of IdNo, I'm going to guess that it is a number field. So the query would be close to this:
Expand|Select|Wrap|Line Numbers
  1. UPDATE tblClientmeds SET IdNo = Forms!your_form!New_Value
  2. WHERE IdNo = Forms!your_form!Old_Value
May 12 '13 #2
neelsfer
547 512MB
thx Seth. I have patients at hospitals that are admitted on emergency Identity numbers based on birth dates. When the patient's own Identity booklet with a unique IdNo arrives hours later, then the IdNo has to be changed in 2 tables based on the new IdNo - tblCient and tblClientMeds. I will try your solution and let you know
May 13 '13 #3
neelsfer
547 512MB
Its working fine Seth. Will use it. Thx for trouble
May 13 '13 #4

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

Similar topics

4
by: JackRazz | last post by:
I'm trying to use Visual Studio's Find/Replace to match VB declarations. This RegEx works fine in Regulator: ...
2
by: :\\\\derian | last post by:
anyone know where i could find the equivalent of the find / replace windows control for my project? :\\derian
2
by: scorpion53061 | last post by:
This excel find/replace code works great under Excel 2003 but bombs with an error (pasted below the code) in Excel 2000. Can anyone suggest an alternative to make both happy? I am using vb.net...
0
by: D Brown | last post by:
Does anyone know why my .NET development would hang / freeze when performing a Global Find / Replace on all files? I have a large ASP.NET VB Application. I have left the machine for 24 hours but...
0
by: vipal.keshwala | last post by:
I just migrated the access data base onto a new server but when I open the application up and click on find/replace in the find what field I try to right click a paste some information, but the...
0
by: Scott | last post by:
Ok I am using the code below to set the default find option but it does not seem to stick. I query the option with getoptions and it is set to 1 but when the find dialog opens it still is set to...
4
by: Joe | last post by:
I need to do a find/replace on a column name in DataColumn.Expression. Is there a way to do the following using RegEx? MyColumn 10 and Desc = "This is MyColumn desc" I need to replace the...
8
by: John Pye | last post by:
Hi all I have a file with a bunch of perl regular expressions like so: /(^|)\*(.*?)\*(|$)/$1'''$2'''$3/ # bold /(^|)\_\_(.*?)\_\_(|$)/$1''<b>$2<\/ b>''$3/ # italic bold...
3
by: go4gator | last post by:
I'm a newbie, and I have an XML data file with Book data. I'm trying to replace a value with a string. Specifically trying to test for "if value is less than 5.00 than replace value with the string...
4
by: Elliot Fraval | last post by:
Hi All, Environment is VBA code in Access 2007. I am having some problems performing a find and replace on text that originates from a memo field in a table. The code is supposed to take...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
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,...

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.