Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to edit all fields

Status
Not open for further replies.

durilai

Programmer
Jan 14, 2005
8
US
I have a table that has a unique field. An example of the data is "12547-aname" and I need to make them all "12547". I am not sure how to do this, any help would be appreciated.
 
Something like this ?
UPDATE yourTable SET yourField = Val([yourField]);

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
How can you perform that in MS Access 2003?
 
open a new query, switch to the SQL view, paste PHV's query, replace yourTable with the tablename you want to update, replace yourField with the name of the field you want to update and run the query.


Leslie
 
Well, not sure if you k now what I need. I dont want to change the field completely, I just want to edit the remaining fields. I used the SQL, but received the exact same output.
 
durilai said:
An example of the data is "12547-aname" and I need to make them all "12547".

durilai said:
I dont want to change the field completely

if you don't want to change it completely, what exactly do you want to do?

Maybe if you provide a small data sample and your table structure and what you want it to look like when you're done, we will have a better idea of what you are really trying to do.

Leslie
 
So, what do you want to do exactly ?
Feel free to post some input samples and expected result.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
That is exactly what the data is:

ID
12345-ABCDE

and I want to delete everything after the last number, so I want to remove the hyphen and the letters. Every record in the field is like that. Thanks for all of your help
 
And this action query doesn't do the trick ?
UPDATE yourTable SET ID = Val([ID]);

You may also try this:
UPDATE yourTable SET ID = Left([ID], InStr([ID], "-")-1)
WHERE ID Like "*-*";

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I was using a regular query, how do you make an action query.
 
By clicking the ! button.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top