Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code to Check Network Access 1

Status
Not open for further replies.

ninfan

Programmer
Feb 16, 2001
49
US
Hello. I have not been able to find a thread with a solution to my problem.

Issue: I have an Access 2003 MDB on a network drive. I have set up network access to specific users who need to use it. Occasionally a person with read-only access will open the MDB, thus locking everyone (including me) out of the DB.

Is there a function I could use in my autoexec module to test for the proper access to the network directory so I can immediately kick them out?

Thank you!

Troy
 
Why not just remove the read only access from the network drive or use Access Security to limit who can open it?

John Green
 
Several things:
- the data is intended only for management (so I can't open it to the world)
- some people have read access to the folder for other reasons
- I'm not the network admin so I don't have total control over user changes that might impact this

Your question makes me think I should solve this in 1 of 2 ways:

1 - Implement Access Security
2 - Split the DB so the front end (and related LDB) will reside on the users PC

Thoughts? I appreciate your feedback.

Troy
 
You can try Access security, but depending on your level of knowledge about VBA there are some much better ways of doing it. I use a custom security system that doesn't require the cumbersome Access security. If you do use Access security make sure you set it up to where the shortcut assigns them to the security file, otherwise they have to sign into each database. I would recommend using a front end/back end set up anyway. That way if something happens to the front end, the data is safe. There are some great FAQs on Access Security that have the type of security I use.

John Green
 
It would be possible to check for write permissions:

Code:
Sub GoAway()
'Make sure Options are set to Break on Unhandled Errors,
'not Break on All Errors
On Error GoTo Error_Trap

Open "C:\DirectoryName\a.txt" For Output As #1
'Print #1, "This is a test."
Close #1
Exit Sub

Error_Trap:
    If Err.Number = 75 Then
        MsgBox "You do not have write permission, please exit."
    Else
        MsgBox "Something happened."
    End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top