Update query help with Instr()

E

Ed Peluffo

I have an Address and Apt Field, Address Filed currently holds the Apt info.
Need to move it to Apt field. most of apt info starts with a # then the
number. How do I create a query to take anything on or after the # sign and
update the apt field with it.

Thanks in advance as my help files don't seem to be working correctly
 
D

Douglas J. Steele

Mid(Address, InStr(Address, "#") + 1) should give you everything that's
after the first # in the string.
 
D

David Whitson

UPDATE Apartment SET Apt = mid(Address,instr
(Address,'#')), Address = mid(Address,1,instr
(Address,'#')-1)

This will MOVE the # and everything after it to the Apt.
field and the second part will REMOVE the # and
everything after it from the Address Field.

David W.
 
E

Ed Peluffo

Thanks for your prompt response

David Whitson said:
UPDATE Apartment SET Apt = mid(Address,instr
(Address,'#')), Address = mid(Address,1,instr
(Address,'#')-1)

This will MOVE the # and everything after it to the Apt.
field and the second part will REMOVE the # and
everything after it from the Address Field.

David W.
 

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

Top