Running code within a query??

jkfeagle

Codus Confusious
Local time
Today, 15:34
Joined
Aug 22, 2002
Messages
166
I have a field with data in it that is imported from an external source. I'm trying to trim the data down to the first 9-12 characters. The data will look something like this:

345623985#http:blah blah blah......

What I want is the number at the beginning. Problem is, this number may vary in number of characters. Now, the code to search through the string to find the # and then cut the rest is pretty simple, but how do I apply it to an update query to trim the data in the table? Can code like that even be used in a query? Am I missing a totally obvious solution other than trying to do this with a query???
 
If, for example you had table myTable, with text
field myField, you could--using your example-- use
this query SQL:
Code:
UPDATE myTable SET myTable.MyField = Left([myField],InStr([myField],"#")-1);
 
Got it working. Thanks for the help!! I figured it was something simple.
 

Users who are viewing this thread

Back
Top Bottom