Removing Data From Feild...

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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))
 
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
 
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
 
Back
Top