Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1. Guest ji, please consider donating today!   Become a Supporter    ::   Make a Contribution   
    Monthly (Recurring) Target: $300 :: Achieved: $95

Novice Needs Help w/Password in Form

Discussion in 'Information Technology' started by EricMalone, Jul 28, 2006.

  1. EricMalone

    EricMalone
    Expand Collapse
    Guest

    This is the code that I have, I need password1 to be any field in the
    password column of the "instructors" table... I don't know how to do it, help
    greatly appreciatd.

    Private Sub Command29_Click()

    If Password5 = "" Or Password5 = Empty Then
    MsgBox "No Input Provided", vbInformation, "Required Data"
    End If

    'If correct password is entered open Employees form
    'If incorrect password entered give message and exit sub

    If Password5 = Password1 Then
    DoCmd.GoToRecord , , acNewRec

    Else
    MsgBox "Sorry, you do not have access to this form", vbOKOnly,
    "Important Information"
    Exit Sub
    End If
    End Sub
     
  2. Loading...

    Similar Threads Forum Date
    17 yr old Baljit needs your help Get Involved Aug 19, 2015
    Needs of Sikhs/Punjabis in the UK Relationships May 22, 2015
    United Sikhs From United Sikhs. Phillippines Needs Your Help Sikh Organisations Nov 22, 2013
    Politics Canada needs to stand up for Dalits Breaking News Oct 27, 2013
    Milkha Singh says India needs to tap into rural talent for athletics Sikh Personalities Jul 23, 2013

  3. Jackie L

    Jackie L
    Expand Collapse
    Guest

    Eric,

    On your login form start with a Login combo box based off the instructor
    table. Have the instructor name and password in the combo box but give the
    password column a size of zero. Have a hidden field on your form called
    ActualPassword. Then on the After Update of the login, put

    Me.ActualPassword = Me.Login.Column(1)

    This will take the password for that instructor and put it in the hidden
    field. Then
    have an unbound field on your form (EnterPassword) where they enter the
    password (you can use an input mask).

    Have a button to open the form you want to go to but on the On Click event
    of that button (or on the After Update event of the EnterPassword field) put

    If Me.EnterPassword = Me.ActualPassword then
    DoCmd.Openform "frmNameofForm"
    Else
    MsgBox "Incorrect Password"
    Exit Sub
    End If

    This is just a quick way to keep a form from being opened. It is not locked
    down security since if someone knows Access, they could open the form from
    the database window.

    Hope this helps.

    "EricMalone" wrote:

    > This is the code that I have, I need password1 to be any field in the
    > password column of the "instructors" table... I don't know how to do it, help
    > greatly appreciatd.
    >
    > Private Sub Command29_Click()
    >
    > If Password5 = "" Or Password5 = Empty Then
    > MsgBox "No Input Provided", vbInformation, "Required Data"
    > End If
    >
    > 'If correct password is entered open Employees form
    > 'If incorrect password entered give message and exit sub
    >
    > If Password5 = Password1 Then
    > DoCmd.GoToRecord , , acNewRec
    >
    > Else
    > MsgBox "Sorry, you do not have access to this form", vbOKOnly,
    > "Important Information"
    > Exit Sub
    > End If
    > End Sub
     
  4. EricMalone

    EricMalone
    Expand Collapse
    Guest

    Thank you very much! I still need a little help.

    I have adapted your method because I don't intend to open a new form, just
    to verify the password before the button opens a new record... but now the
    input password field stays filled in after I click a new form. Help
    appreciated.

    Thanks,
    Eric

    "Jackie L" wrote:

    > Eric,
    >
    > On your login form start with a Login combo box based off the instructor
    > table. Have the instructor name and password in the combo box but give the
    > password column a size of zero. Have a hidden field on your form called
    > ActualPassword. Then on the After Update of the login, put
    >
    > Me.ActualPassword = Me.Login.Column(1)
    >
    > This will take the password for that instructor and put it in the hidden
    > field. Then
    > have an unbound field on your form (EnterPassword) where they enter the
    > password (you can use an input mask).
    >
    > Have a button to open the form you want to go to but on the On Click event
    > of that button (or on the After Update event of the EnterPassword field) put
    >
    > If Me.EnterPassword = Me.ActualPassword then
    > DoCmd.Openform "frmNameofForm"
    > Else
    > MsgBox "Incorrect Password"
    > Exit Sub
    > End If
    >
    > This is just a quick way to keep a form from being opened. It is not locked
    > down security since if someone knows Access, they could open the form from
    > the database window.
    >
    > Hope this helps.
    >
    > "EricMalone" wrote:
    >
    > > This is the code that I have, I need password1 to be any field in the
    > > password column of the "instructors" table... I don't know how to do it, help
    > > greatly appreciatd.
    > >
    > > Private Sub Command29_Click()
    > >
    > > If Password5 = "" Or Password5 = Empty Then
    > > MsgBox "No Input Provided", vbInformation, "Required Data"
    > > End If
    > >
    > > 'If correct password is entered open Employees form
    > > 'If incorrect password entered give message and exit sub
    > >
    > > If Password5 = Password1 Then
    > > DoCmd.GoToRecord , , acNewRec
    > >
    > > Else
    > > MsgBox "Sorry, you do not have access to this form", vbOKOnly,
    > > "Important Information"
    > > Exit Sub
    > > End If
    > > End Sub
     
  5. Jackie L

    Jackie L
    Expand Collapse
    Guest

    In your code, after the password is verified, put:

    Me.EnterPassword = ""

    Hope this helps.


    "EricMalone" wrote:

    > Thank you very much! I still need a little help.
    >
    > I have adapted your method because I don't intend to open a new form, just
    > to verify the password before the button opens a new record... but now the
    > input password field stays filled in after I click a new form. Help
    > appreciated.
    >
    > Thanks,
    > Eric
    >
    > "Jackie L" wrote:
    >
    > > Eric,
    > >
    > > On your login form start with a Login combo box based off the instructor
    > > table. Have the instructor name and password in the combo box but give the
    > > password column a size of zero. Have a hidden field on your form called
    > > ActualPassword. Then on the After Update of the login, put
    > >
    > > Me.ActualPassword = Me.Login.Column(1)
    > >
    > > This will take the password for that instructor and put it in the hidden
    > > field. Then
    > > have an unbound field on your form (EnterPassword) where they enter the
    > > password (you can use an input mask).
    > >
    > > Have a button to open the form you want to go to but on the On Click event
    > > of that button (or on the After Update event of the EnterPassword field) put
    > >
    > > If Me.EnterPassword = Me.ActualPassword then
    > > DoCmd.Openform "frmNameofForm"
    > > Else
    > > MsgBox "Incorrect Password"
    > > Exit Sub
    > > End If
    > >
    > > This is just a quick way to keep a form from being opened. It is not locked
    > > down security since if someone knows Access, they could open the form from
    > > the database window.
    > >
    > > Hope this helps.
    > >
    > > "EricMalone" wrote:
    > >
    > > > This is the code that I have, I need password1 to be any field in the
    > > > password column of the "instructors" table... I don't know how to do it, help
    > > > greatly appreciatd.
    > > >
    > > > Private Sub Command29_Click()
    > > >
    > > > If Password5 = "" Or Password5 = Empty Then
    > > > MsgBox "No Input Provided", vbInformation, "Required Data"
    > > > End If
    > > >
    > > > 'If correct password is entered open Employees form
    > > > 'If incorrect password entered give message and exit sub
    > > >
    > > > If Password5 = Password1 Then
    > > > DoCmd.GoToRecord , , acNewRec
    > > >
    > > > Else
    > > > MsgBox "Sorry, you do not have access to this form", vbOKOnly,
    > > > "Important Information"
    > > > Exit Sub
    > > > End If
    > > > End Sub
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page