Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Mar 2004
    Location
    White Oak, Pennsylvania, USA
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Changing File Name (Access 2002)

    In our system, members photos are stored as jpg files with the FamilyNumber and Member Number constituting the name of the file i.e Kics02346-004.jpg

    Ocassionally, we need to change either a family or member number and therefore I need to change the name of the jpg file that corresponds to that person i.e. Kics02346-005.jpg as the new file name.

    What would be the best code to use accomplish that?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Changing File Name (Access 2002)

    You can use the Name command:

    Name "Kics02346-004.jpg" As "Kics02346-005.jpg"

    Both the old and new file names can be variables or expressions, e.g.

    Const strPath = "Kics"
    Const strExt = ".jpg"
    Dim strOld As String
    Dim strNew As String
    strOld = "02346-004"
    strNew = "02346-005"
    Name strPath & strOld & strExt As strPath & strNew & strExt

  3. #3
    Star Lounger
    Join Date
    Mar 2004
    Location
    White Oak, Pennsylvania, USA
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing File Name (Access 2002)

    Thanks - big help, as always!

Posting Permissions

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