Results 1 to 2 of 2
  1. #1
    DrGlenn is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1

    P/W Protect & Open Database Using VBA

    (Enthusiastic Beginner!)

    Hi......

    I'm trying to write a piece of code to open a database and immediately give the user a chance to input a password (i.e. for full access) or alternatively to open STRICTLY as 'Read Only' i.e. no access to the back end or ability to input new/manipulate current records/data.

    My efforts with the following code has so far failed (miserablely)!

    Sub AutoExec()
    Dim strPassword As String
    Dim blnLoginValid As Boolean

    strPassword = InputBox("Enter the CUSTODIAN Password:", " This Database is Password Protected")
    If strPassword = "Anytext" Then
    blnLoginValid = True
    DoCmd.RunCommand acCmdOpenDatabase
    Else
    MsgBox "Sorry, You can only open on a READ ONLY basis or you can retry?", vbRetryCancel, "MyDatabase"
    blnLoginValid = False


    DoCmd.RunCommand acCmdOpenDatabase, acReadOnly
    'AutoExec
    End If
    End Sub

    Any input appreciated!

  2. #2
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682

    Security

    Although this doesn't answer your specific question, attached is what I do for security. It works quite well.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. open a secure database
    By ngeng4 in forum Security
    Replies: 5
    Last Post: 08-01-2010, 10:57 PM
  2. cannot open any database
    By Factor in forum Access
    Replies: 3
    Last Post: 03-24-2010, 12:51 PM
  3. readonly password protect
    By mlgehle in forum Security
    Replies: 1
    Last Post: 03-13-2010, 08:59 PM
  4. Password Protect Forms
    By Robert M in forum Programming
    Replies: 3
    Last Post: 01-15-2010, 01:50 PM
  5. Open form in another database
    By Karyn-2000 in forum Forms
    Replies: 0
    Last Post: 04-19-2006, 10:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums