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!

Formatting a string with an update query.

Status
Not open for further replies.

ErikZ

Programmer
Feb 14, 2001
266
US

I have a field where all the records in it need to be modified. The strings are of varying length, but they all end with "HTTP1.1"

How do I remove the last 7 characters of a string?
 
Assume that the field that contains the data is called FullField. Then use the following code:

TruncatedField = left(FullField, len(FullField)-7)

Ideas: Its advisable to build this into a functon and add some additional logic and error handling in case the field is null, or in case it does not end in "HTTP1.1"

Hope this helps,
Steve
 
Hmm, not exactly what I had in mind. But you've set me on the path.

I'm using an update query, so if I modify your code to this:

Left([Fullfield],Len([Fullfield])-7)

It works perfectly! Thanks!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top