usb drive reference

  • Thread starter Thread starter eloy
  • Start date Start date
E

eloy

i have several macros that call files on my usb drive. the problem is that
the usb drive # (e:\, f:\, etc.) is different when i change computers and
therefore the macro fails. is there a solution to this problem?
eloy
 
I'm not sure there's a reliable solution.

While you could write a VBA function to check for which drive letter is a
USB drive (see http://www.mvps.org/access/api/api0003.htm at "The Access
Web" for the sort of code you'd need to use), what are you going to do if
there's more than one USB drive plugged in?
 
1) It is messy and cluggy, but you might add a field to the form that
executes the macro and ask for the drive letter of the USB port and
have it default to the normal one.

OR maybe

2) On the device (thumb drive?) place a file that has a unique name
then maybe use a len(dir(xxxx) for that file name for that file and go
through a couple of thestandard letters that could be used. to see if
it is there and do it to the one where it is found.

OR maybe

3) Check for the existence of a txt file called whatever.txt and if it
is not there then ask for the appropriate drive for that computer.
After you get that then create that txt file on that computer for that
drive letter. From then on you will find the txt file and it will
contain the proper drive letter for that computer. (Maybe include
somewhere the ability to change that letter, or combine solution 1
above with this to allow easy change of the letter - add the search
for the file to solution 1 to get the proper default and recreate the
file if the letter is changed. You could also use a local table, but
then if you gave them a new version of the FE then they would have to
re-enter the proper letter - I like the txt file idea better.)

Just some ideas......

Ron
 
Back
Top