Reading files from a drive

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I've got a strange one for you access Guru's.

Everyday we download txt files and my access program extracts the data from
the files and puts them into a table.

When the user I have created the program for tries to run the program, no
files are found. when I run the program the files are found.

* The user has full access rights to the folder and parent folders
* The user can access the directory through command prompt and GUI
* the user
* When I log into his computer I can access the files through access
* The user cannot access the files whilst logged onto another computer.
* If the path is set to a local directory, it works.
* the program was working for 6 weeks for the user and nothing has changed
except the program now doesn't work for this user.
Code used

ChDir ("\\HOBS\HobsInsolDownloads\")
strfile = Dir("insolgroup*.*")
Do While Len(strfile) > 0
 
There's something different between his and your login scripts at network
level. It could be something as simple as the drives are mapped differently.
Compare your login scripts and also the exact path of the mapped drives. You
might even consider using UNCs instead of mapped drives.
 
Hi Chris,

I think the problem is that this
ChDir ("\\HOBS\HobsInsolDownloads\")

changes the current directory *in the share \\HOBS* but this
strfile = Dir("insolgroup*.*")

looks in the current directory in the current drive (typically C:).
AFAIK you can't set the current drive to an unmapped network share, so
the options appear to be

1) map the share to the same drive letter in all computers (e.g. Q:) and
use

ChDir "Q:\HobsInsolDownloads"
ChDrive "Q"
strFile = Dir("insolgroup*.*)

2) use the UNC path throughout (The VBA Dir() function appears to accept
UNC, though I don't know whether this is 100% the case.)

strFile = Dir("\\HOBS\HobsInsolDownloads\insolgroup*.*)
 
Thanks you were dead right!


John Nurick said:
Hi Chris,

I think the problem is that this


changes the current directory *in the share \\HOBS* but this


looks in the current directory in the current drive (typically C:).
AFAIK you can't set the current drive to an unmapped network share, so
the options appear to be

1) map the share to the same drive letter in all computers (e.g. Q:) and
use

ChDir "Q:\HobsInsolDownloads"
ChDrive "Q"
strFile = Dir("insolgroup*.*)

2) use the UNC path throughout (The VBA Dir() function appears to accept
UNC, though I don't know whether this is 100% the case.)

strFile = Dir("\\HOBS\HobsInsolDownloads\insolgroup*.*)
 
Back
Top