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

Replace prefix on a field within table

Status
Not open for further replies.

Pilly170

IS-IT--Management
Aug 28, 2003
36
US
Hi,

I have a table, one field has data inserted with a prefix eg K 10292.
Is there an easy way to remove the "k" via VBA?? or am i looking to do an update query?

I did a search on the forums but couldnt find the answer, i can do it within excel but need to complete within access, any ideas?.
 
fld = "K 10292"
right (fld, len(fld) - 2) will give you "10292
 
and if i have to manipulate every row??
 
Something like this ?
UPDATE yourTable SET yourField=Mid(YourField,3)
WHERE yourField LIKE 'K %';

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
for example then

Function UpdateDaums()
Dim strSQL As String


strSQL = "UPDATE Daums SET CustNo=Mid(CustNo,3)WHERE CustNo LIKE 'K %';"
DoCmd.SetWarnings warningsoff
DoCmd.RunSQL strSQL
DoCmd.SetWarnings warningson
End Function

 
Changed the % to * and it works fine... thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top