Syntax for multi steps in query

  • Thread starter Tony in Michigan
  • Start date
T

Tony in Michigan

Hello,
I'm looking for some help with queries. I would like to combine multiple
steps done with queries into single queries.

example I have a data field with 20 spaces xxx-xxxxxxx-x_nnnnnn
currently, to pull the needed portion, i do 2 steps with an update query,
updating a blank field with the new data.
q1: left([field]),13)
q2: replace([field],Chr(45)"")

How would I combine the steps? Is there a more elegant way of doing this?
I have not graduated to SQL, but given some guideance, I'm willing to go in
that direction.
 
S

Sylvain Lafontaine

Try with: Replace (Left([field],13), Chr(45), "")

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)
 
T

Tony in Michigan

Merci Sylvain!

It worked perfectly, plus I have already applied the same thought process to
several other multi step queries.

It looks counter intuitive, putting the replace first. I guess that I'll
figure out the subtle nuances over time

Sylvain Lafontaine said:
Try with: Replace (Left([field],13), Chr(45), "")

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)


Tony in Michigan said:
Hello,
I'm looking for some help with queries. I would like to combine multiple
steps done with queries into single queries.

example I have a data field with 20 spaces xxx-xxxxxxx-x_nnnnnn
currently, to pull the needed portion, i do 2 steps with an update query,
updating a blank field with the new data.
q1: left([field]),13)
q2: replace([field],Chr(45)"")

How would I combine the steps? Is there a more elegant way of doing this?
I have not graduated to SQL, but given some guideance, I'm willing to go
in
that direction.
 

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