Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002
    Location
    Christchurch - NZ
    Posts
    3

    Question Unanswered: Extracting file types

    Hi all

    In my database I have a txtFilepath field to store the path of a document on my local machine. My question is this, is there a way to extract the file extension from the path and add it to a separate txtFiletype field automatically?

    Thanks,
    Simon Murphy
    Christchurch, New Zealand

  2. #2
    Join Date
    Nov 2002
    Location
    San Francisco
    Posts
    251
    strOriginalPath = "C:\Program Files\My Software\My File.DOC"

    strPathWithoutExtension = Left(strOriginalPath, InStrRev( strOriginalPath, "."))
    strExtensionWithoutPath = right(strOriginalPath, Len(strOriginalPath) -

    InStrRev(strOriginalPath, "."))

    MsgBox strPathWithoutExtension
    MsgBox strExtensionWithoutPath


    is this what you want?



    jiri

  3. #3
    Join Date
    Dec 2002
    Location
    Christchurch - NZ
    Posts
    3

    Thanks. One further thing....

    strOriginalPath = "C:\Program Files\My Software\My File.DOC"

    strPathWithoutExtension = Left(strOriginalPath, InStrRev( strOriginalPath, "."))
    strExtensionWithoutPath = right(strOriginalPath, Len(strOriginalPath) -

    InStrRev(strOriginalPath, "."))
    That's excellent, thanks very much. Just one more thing....Is there a way to let the strOriginalPath equal the value of a field in the record (from a file select box), as opposed to a set string value?

    Many thanks
    -Simon

Posting Permissions

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