Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Thanked 0 Times in 0 Posts

    protect special function (Access 2000)

    I have a special function i need to protect with a pasword. How can i achieve that?

    I have begun my code in the following way :

    Dim intAnswer As Integer
    Dim StrPassword As String
    StrPassword = " bobi"
    intAnswer = MsgBox(" password ? ", vbQuestion + vbYesNo)
    If intAnswer = vbYes Then
    execute the function
    Exit Sub
    End If

    It is wrong, since I cannot find the way to write the password bobi in the box

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: protect special function (Access 2000)

    MsgBox can only be used to display a message. To let the user enter a string, use InputBox

    Dim strPassword As String
    strPassword = InputBox("Please enter the password")
    If strPassword = "bobi" Then
    ' execute the function
    MsgBox "Password not correct", vbExclamation
    Exit Sub
    End If

    Note: this is not very secure, if the user knows how to look at the VBA code, he/she can find the password.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts