Search and Replace code

  • Thread starter Thread starter dwight
  • Start date Start date
D

dwight

How do I write code to accept a Search String and a
Replace String for a table in my database.

I would appreciate any help you could give this is my
Second Request....
 
Hi

Well you decription of what you are requestinfg is very vague

But to Update Data in a table there are different ways

1 way is with a Query. And to run the Query through code you would use something like this..

SQLinstruction = "UPDATE TableName SET FieldName=NewValue WHERE (conditions go here)
DoCmd.RunSQL (SQLinstruction

Here is an example if you want to change a persons Address from data entered in TextBoxes on a From

SQLinstruction = "UPDATE Employees SET Address = " & Chr(34) & AddressTextBox.Value & Chr(34) & "WHERE Name = " & chr(34) & NameTextBox.Value & Chr(34)
DoCmd.RunSQL (SQLinstruction

Note: the Chr(34) is a " since you are comparing a string you need to surroud them by

If you want to modyify strings there are String functions you can us
MID(
LEFT(
RIGHT(
Look these up in the Help Menu

ANother way to update Data is through RecordSets, also look that up in the Help Menus, there is too much to explain on these

I hope this helps
Jef
 
Back
Top