View Single Post
  #2  
Old July 30th, 2004, 01:43 PM
Rick Brandt
external usenet poster
 
Posts: n/a
Default password-protected form

"Sam Kuo" .(donotspam) wrote in message
...
Katherine wrote:
Is it possible to password protect a form rather than the
entire Database?


Gerald Stanley replied:
Something along the lines of

Private Sub Form_Open(Cancel As Integer)
Const strFormPassword As String = "Password"


If InputBox("Please Enter Password") strFormPassword Then
MsgBox "Password Incorrect", vbOKOnly
Cancel = True
End If


End Sub


I have a commond button on form1 that opens the password-protected form2.

If incorrect password is entered, the code above shuts form1 which was
opened originally. Can this code be altered in such way that form1 remains
open if incorrect password is entered, and possibly with a pop-up message
asking to try again?

If the code behind the button is closing Form1 then there has to be a
statement in the code that is doing so. It would look like...

DoCmd.Close (possibly more arguments here)

Just find that line and remove it.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com