Search and Replace code

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....
 
J

Jeff

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top