Results 1 to 5 of 5

Thread: Is a networked file accessible ???

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    Brossard, Québec, Canada
    Posts
    241

    Post

    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

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    either trap the error when opening the database or use:
    Code:
    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

    [email protected]
    A BMW Group Company

  3. #3
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    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
    [email protected]
    [email protected]


  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    Brossard, Québec, Canada
    Posts
    241

    Post

    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?

  5. #5
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    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
    [email protected]
    [email protected]


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width