Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Vernon27 is offline Novice
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    7

    How to change drive letter in input form


    Hello All,
    I am using MS Access 2007 on a Windows 7 Home Premium desktop pc. I have an access database that list all the movies that I have in my collection. Included with the database are tables, queries and reports. In addition, the database listed any movie clips that I have on the pc’s hdd. In the input form is a field I called Location. That field will point to the location and name of the movie clip. When I built thie database years ago I had the movies stored on the E: drive in the Movies sub-directory (E:\Movies\xxx); where xxx represents the name of the movie.
    I have since then purchased a new pc and the drive letters have changed; the movie clips are now stored on drive F: as that drive is a two terabyte drive.
    Question: How to I chance the drive letter in my form from E:\Movies\xxx to F:\Movies\xxx; without having to manually change it in each field one at a time. I am looking for an "automated" process similar to the Find and Replace option in Word. It should be noted that the field is a hyperlinked field so when you click on the data in the field MS Access will look for the drive and the subfolder and then the name of the movie and it will start to play in MS Media Player.
    Thanks in advance for your help.

    Vernon

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    One way would be an update query using the Replace() function.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Vernon27 is offline Novice
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    7
    pbaldy, thanks for the quick reply. Will this the expression that I would use:

    Replace("E:\Movies","E","F")

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    You can try, but I wouldn't.

    That would also replace the e in movies. I'd do

    Replace("E:\Movies","E:\","F:\")

    In reality you're going to want a field name for the first argument, not a literal string.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Vernon27 is offline Novice
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    7
    Hmm, not sure how I will do that. As you can tell I am a novice at this.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    You have a field in a table that contains these references, and you want to change them, right?

    UPDATE TableName
    SET FieldName = Replace(FieldName,"E:\","F:\")

    should change all records in the table. Make a backup before you try it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Vernon27 is offline Novice
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    7
    I have a field in the table called Location and it's in the Movies table.

    So it looks like the expression will be:

    UPDATE Movies
    SET Location = Replace("E:\Movies","E:\","F:\")

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Make sure you make a copy first. Like I said and showed, you likely want the field name in the Replace() function, not the literal string.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Vernon27 is offline Novice
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    7
    Ok, I will try it this weekend and let you know. Thanks for your direction.

  10. #10
    Vernon27 is offline Novice
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    7
    Hello pbaldy,

    I tried your query and it did not work. I created a new query and entered the expression and it still did not work. Do you know how I can enter the expression in a script maybe it will work then. Thanks for your help.

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Can you post the SQL of your attempt? Or a sample db?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    amer is offline Novice
    Windows XP Access 2002
    Join Date
    Jun 2010
    Posts
    14
    I have the same problem here.... well I working with images not movies.

    The fix you suggested looks a little different in my version of Access (2002)

    I have a copy of 2007 put I have not updated it yet. I already moved my images to a new drive so I wanted to get everything working again before I switched to the new version.

    I have this.

    \\JOSE\Shared\the name of the image

    and I need to change it to

    R:\the name of the image
    Last edited by amer; 06-04-2010 at 12:12 PM. Reason: mistake

  13. #13
    amer is offline Novice
    Windows XP Access 2002
    Join Date
    Jun 2010
    Posts
    14
    I was able to change it using the replace command in the datasheet view but it only changed the text field and not the actual hyperlink.

  14. #14
    Jim Doherty is offline Novice
    Windows XP Access 2000
    Join Date
    May 2010
    Location
    Derbyshire,England. UK
    Posts
    20
    As an aside to this for your info if you merely want to access an F Drive and make it appear as E without changing anything in your database then type the following into the run box......... SUBST command E: F:\

    This will give you a virtual drive letter aliased

  15. #15
    Vernon27 is offline Novice
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    7
    This is what I have in the Criteria section in the design view of the query.

    Replace("E:\Movies\","E:\Movies\","C:\Users\Vernon 27\AppData\Files for Future Installations\Pictures and Movies\Movies\")

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Checking for trailing letter
    By jgelpi16 in forum Queries
    Replies: 2
    Last Post: 03-23-2010, 09:27 AM
  2. Drive type identifier
    By dcrake in forum Sample Databases
    Replies: 0
    Last Post: 08-19-2009, 04:15 AM
  3. Problems with Access 2003\2007 and shared drive
    By swasielewski in forum Access
    Replies: 3
    Last Post: 07-10-2009, 06:32 AM
  4. From letter from a report
    By LANCE in forum Reports
    Replies: 4
    Last Post: 07-04-2009, 09:32 AM
  5. Multi Users on shared drive
    By wallen in forum Access
    Replies: 0
    Last Post: 08-25-2008, 08:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums