Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search and Replace

Status
Not open for further replies.

northy666

Programmer
Sep 5, 2001
2
EU
Pretty simple question but...What is the best / quickest way (using vba) to search a table for a record and change one of the values in its fields ?
 

The quickest and easiest way to find a record and replace or update a value is to use an UPDATE query. From VBA you can use the RunSQL method of DoCmd to execute a query.

Example: Update a column in a table to a value in a text box on the form based on the criteria in another text box.

Dim StrSQL As String

strSQL="UPDATE MyTable SET col1='" & txtNewValue & "'"
strSQL=strSQL & " WHERE keycol=" & Me.txtCriteria

DoCmd.RunSQL strSQL Terry L. Broadbent
Life would be easier if I had the source code. -Anonymous
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top