Help with instrRev syntax

Results 1 to 3 of 3

Thread: Help with instrRev syntax

  1. #1
    Kentium Guest

    Default Help with instrRev syntax

    I&#039;ve got this-<BR><BR>elseif InstrRev(objRec("fname"),"txt", 1, vbTextCompare) then typeicon = "/images/global/icon_text.gif alt=Text"<BR><BR>It&#039;s not showing my spiffy little Text icon! If I remove the start, and compare modifiers, it works fine, but doesn&#039;t show the spiffy Text icon if the file name extension is in all CAPS- test.TXT.<BR><BR>Is my syntax wrong for using start and compare?<BR><BR>Thanks a bunch!<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Not syntax...semantics...

    You are asking it to start searching *BACKWARDS* at the first character. Ummm...but you are looking for 3 characters. So it will never find those three characters in the 1 character of text you are allowing it.<BR><BR>Use -1 instead of 1 for the third argument! Read the docs: -1 means "search the entire string".<BR><BR>BUT...<BR><BR>I don&#039;t like this code, anyway.<BR><BR>You are going to see a filename such as "vartxture.gif" as containing "txt" and you will assume it is a text file!<BR><BR>Wouldn&#039;t it be safer/smarter to look for ".txt" as the last 4 characters of the name?<BR><BR>So...<BR><BR>... Elseif LCase(Right(objRec("fname"),4)) = ".txt" Then ...

  3. #3
    Kentium Guest

    Default Ahh ha!

    Right you are again! You&#039;re solution is mucho better!<BR><BR>Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts