Removing Data From Feild...

G

Guest

Greetings,

I have a table that holds information about orders... it has 12 feilds. The
original creator of the database didn't create separate feilds for the
pickup_address and pickup_state. So, the pickup_address feild as data
formatted like this:

Kingsville, TX

What I need to do is create a query that will delete the ", XX" part of each
record (so all that is left is the city). Is this possible? Perhaps a query
that simply deletes the last 4 characters of each record? Stuck, please
help. Thank you...

Jason Nelson
 
G

Guest

To remove the four right digit you can write
UPDATE MyTable SET pickup_address = Left([pickup_address
],Len([pickup_address ])-4)

But I would try that, it will remove the four digits only if you have the
"," in the string.
UPDATE MyTable SET MyTable.pickup_address = Left([pickup_address
],Len([pickup_address ])-4)
WHERE (((InStr([pickup_address ],","))=True))
 
G

Guest

Thanks,

Your code worked perfectly.

Jason

Ofer said:
To remove the four right digit you can write
UPDATE MyTable SET pickup_address = Left([pickup_address
],Len([pickup_address ])-4)

But I would try that, it will remove the four digits only if you have the
"," in the string.
UPDATE MyTable SET MyTable.pickup_address = Left([pickup_address
],Len([pickup_address ])-4)
WHERE (((InStr([pickup_address ],","))=True))


Jason said:
Greetings,

I have a table that holds information about orders... it has 12 feilds. The
original creator of the database didn't create separate feilds for the
pickup_address and pickup_state. So, the pickup_address feild as data
formatted like this:

Kingsville, TX

What I need to do is create a query that will delete the ", XX" part of each
record (so all that is left is the city). Is this possible? Perhaps a query
that simply deletes the last 4 characters of each record? Stuck, please
help. Thank you...

Jason Nelson
 
G

Guest

Any time

Jason said:
Thanks,

Your code worked perfectly.

Jason

Ofer said:
To remove the four right digit you can write
UPDATE MyTable SET pickup_address = Left([pickup_address
],Len([pickup_address ])-4)

But I would try that, it will remove the four digits only if you have the
"," in the string.
UPDATE MyTable SET MyTable.pickup_address = Left([pickup_address
],Len([pickup_address ])-4)
WHERE (((InStr([pickup_address ],","))=True))


Jason said:
Greetings,

I have a table that holds information about orders... it has 12 feilds. The
original creator of the database didn't create separate feilds for the
pickup_address and pickup_state. So, the pickup_address feild as data
formatted like this:

Kingsville, TX

What I need to do is create a query that will delete the ", XX" part of each
record (so all that is left is the city). Is this possible? Perhaps a query
that simply deletes the last 4 characters of each record? Stuck, please
help. Thank you...

Jason Nelson
 

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