It works fine when I am testing it in the database. However when I compile it to a .accde executable, it does not give the pop up window and challenge for a password. It simply allows access to the sensitive form.
I know that Access usually compiles the code and then deletes the source code, but is that what is causing the problem? Let me know if any of you have an ideas.
Thanks,
Tom
Code for thought:
Expand|Select|Wrap|Line Numbers
- Dim Password As String
- Password = InputBox("Enter Administrator Password")
- If Password = "mypasscode" Then
- ' Open Form
- DoCmd.OpenForm "AdminPage"
- DoCmd.GoToRecord , , acNewRec
- Else
- MsgBox ("You're not authorized to access this page.")
- DoCmd.Close
- End If