UpDate Query

N

NotGood@All

I have a table that has 3 fields, Inmate Name, FirstName, & LastName. In the
Inmate Name field they have the whole name "Smith, John". I want to to put
Smith in the LastName column, and John in the FirstName column. I entered
LastName:left([Inmate Name]),instr([Inmate Name]),",")-1) but I get "wrong
number of arguments. Can someone help me? please
 
K

Ken Snell MVP

UPDATE Tablename
SET LastName = Left([Inmate Name], InStr([Inmate Name], ",") - 1),
FirstName = Mid([Inmate Name], InStr([Inmate Name], ",") + 1)
WHERE InStr([Inmate Name], ",") <> 0;
 
K

KC-Mass

Hi,

You need to watch your parenthesis. Try:
LastName:left([Inmate Name],instr([Inmate Name],",")-1)

You should store the first and last names separately and then get rid of the
Inmate Name field which is redundant data.

Regards
Kevin
 

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

Similar Threads

Lookup 5
auto-fill based on unique field 1
Forms design 1
right align in vb code? 4
my autofill won't work ??? 2
Subform Nightmare.. 6
Subform Dilemma 2
Combine 2 fields into 1 via SQL query 2

Top