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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing multiple records in a table 1

Status
Not open for further replies.

jasonsas

Technical User
Oct 2, 2002
63
AU
HI,

Hopefully I'm posting in the right forum. I have a field in a table which contains many records. What I'd like to do is change multiple entries from one thing to another Eg, from "Manager - Technical Services" to "Manager, Technical Services".

Is there a quick easy way to do this?

Thanks
 
Use an update query.
see help on this topic heading "Create an update query"

________________________________________________________________________
Zameer Abdulla
Visit Me
A person who misses a chance and the monkey who misses its branch can't be saved.
 
Create a new query and using the sql view in design it would look something like this

Update table1 set jobtitle = 'Manager, Technical Services' WHERE jobtitle - 'Mangager - Technical Services';

This is assuming that the table name is tabel1 and the field you want to change is jobtitle.



Andy Baldwin
 
In a standard code module named, say, Module1, create the following function:
Code:
Public Function myReplace(myString, myFind As String, myRepl As String)
If Trim(myString & "") <> "" Then
  myReplace = Replace(myString, myFind, myRepl)
End If
End Function
And now your update query:
UPDATE yourTable
SET yourField = myReplace([yourField], ' - ', ', ')
WHERE yourField Like '* - *'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Jason

Eg, from "Manager - Technical Services" to "Manager, Technical Services".

Hind sight...
To maintain consitancy for this type of thing, you may wish to consider adding a support table or tables where the job codes are restricted to a "pick list". A typical approach would be to use a combo or list box to reference the other table.

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top