Click to See Complete Forum and Search --> : Is a networked file accessible ???
David Laplante
Jan 9th, 2000, 01:27 PM
I have this database app where on its opening, I would like to alert the user if he doesn't have network access to the database...
I have the path of the database in the registry and would like to see on each opening of the app if the user actualy has access to that path...
thanks for your help
Mark Sreeves
Jan 9th, 2000, 03:25 PM
either trap the error when opening the database or use:
Public Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA" (ByVal lpFileName As String) As Long
this returns -1 if the file doesn't exist
------------------
Mark Sreeves
Analyst Programmer
Mark.Sreeves@Softlab.co.uk
A BMW Group Company
Aaron Young
Jan 9th, 2000, 10:28 PM
You could just as easily use the Dir function to check the files existence and thereby if the user has access, ie.
If Len(Dir("F:\PathToDB\TheDB.Mdb")) = 0 Then Msgbox "No Access To Database"
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
ajyoung@pressenter.com
David Laplante
Jan 10th, 2000, 12:57 AM
Thanks for the help...
I haven't tried the API Call cuz I want to keep it simple but when I use DIR... if I don't have access to the specified path, my app stops responding... I'm using MS-Access 2000...
Any ideas why it does that and how I can correct it?
Aaron Young
Jan 10th, 2000, 01:16 AM
If you're using a UNC, (Universal Naming Convention), path it may seem to lock up if it can't find the Workstation\Server. If this is the case try using a Logical Drive Path, ie. "F:\Folder\Database.mdb".
I've not been unlucky enough to use Access2000.. Yet.
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
ajyoung@pressenter.com
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.