search for a string within a string

cedtech23

Registered User.
Local time
Today, 06:19
Joined
Jan 28, 2006
Messages
25
I have a column called CPU_S within a table called workstation that contains sample text like P111 933

I want to use the update command to search the CPU_S column for entries that contain this in there string then add P3 to a column called CPU_N

So far I have the code below but I don't know how to search a column entry for a specific string within a string. Can this be done and how?

Code:
UPDATE workstations SET CPU_N = "P4"
WHERE CPU_S = ;
 
look up the InStr function in Access help.
 
Ok I used

Code:
UPDATE workstations SET CPU_N = "P3"
WHERE InStr(1, [CPU_S], "P111") > 0;

on that note say I wanted to delete just that portion of the string from the column but leave everything else. How would I do that??
 
Thanks ended up doing the following to get it to work for me


Code:
UPDATE workstations SET CPU_S = Replace([CPU_S],"PII","")
WHERE InStr(1,[CPU_S],"PII")>0;
 

Users who are viewing this thread

Back
Top Bottom