(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!