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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using InStr & Len

Status
Not open for further replies.

homer661

Programmer
May 11, 2001
9
US
I want to take my picture fields in my database and change the extension of them. My picture field [IN_Pic] looks like this:

umpic26923.jpg

I wrote this statement:

"th_" & Left([IN_Pic],Len([IN_Pic])+InStr([IN_Pic],".")) & ".gif"

Now my picture looks like this:

th_umpic26923.jpg.gif

I need it to look like this:

th_umpic26923.gif

Can someone help me out here?
 
Hmm...why even use the InStr function?

"th_" & Left([IN_Pic],(Len([IN_Pic])-4) & ".gif"

When you add the -4 part to the Len function, it will return everything except the last 4 characters, which are the .extension part...

I tested this and it works fine. :)

HTH

Greg Tammi, ATS
E-mail: gtammi@atsbell.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top