Confirm Read/Write Access to network drive

C

Chris Freeman

I have a database that outputs a file to a network drive. I have code that
cofirms existence of the directory before performing the output, but we keep
failing on the new user having 'write' access to the server. Is there simpler
way to confirm if the user has write access than writing a file to the drive
and having it fail?
 
C

Clifford Bass

Hi Chris,

I am sure you can do that through some of the Windows APIs (DLLs), but
it probably would be rather ugly. When you say that you keep failing, are
you using error handling to trap for that condition so you can warn the user
and retry? Or just letting the process bomb out?

Clifford Bass
 
C

Chris Freeman

Cliff,
I've been handling it in error, but I wanted to do something before the user
started the process so data integrity was maintained. My current work around
is to open the file on the server, changes values, and then save it. On
error, close the file, no save, and message box to warning they don't have
access. I was hoping there was a more elegant way to do so.

thanks
 
C

Clifford Bass

Hi Chris,

If there is an elegant way, it does not seem to be widely know. I did
come across the DOS command CACLS very recently which perhaps could be used
in some way. Maybe run it, specifying the folder of interest and redirecting
the output to a file in another folder. Then reading in the file and parsing
the data. This still seems rather ugly.

One possible variation on what you are doing would be to attempt to
create a new text file in the target directory and then try to write a single
line to it. If any of those steps fail, report. Otherwise, close the file,
delete it and then do the actual processing of your actual file. Note that
someone may also not have access due to someone else having opened the file
exclusively.

Good Luck,

Clifford Bass
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top