Welcome to SPN

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

Sign Up Now!

Password

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

Tags:
  1. Tom

    Tom
    Expand Collapse
    Guest

    Hi all,
    I have a button on a form that delete records.
    Is it possiableto make it password protected?
    when the user press it it will ask for password and thenit will continue
    with the deletion.

    Thanks,
    Tom
     
  2. Loading...

    Similar Threads Forum Date
    I became victim by Password hacker Hard Talk May 27, 2012
    Legal Sharing Passwords with Spouse is Risky Breaking News Oct 14, 2011
    Password for Sikhs: "WAHEGURU" ! Spiritual Articles Apr 4, 2006

  3. Pieter Wijnen

    Pieter Wijnen
    Expand Collapse
    Guest

    sure thing
    add a inputbox to the code & match it
    Better to assign user rights though

    Pieter

    "Tom" <partner1973@yahoo.com> wrote in message
    news:uRbalMffGHA.4496@TK2MSFTNGP03.phx.gbl...
    > Hi all,
    > I have a button on a form that delete records.
    > Is it possiableto make it password protected?
    > when the user press it it will ask for password and thenit will continue
    > with the deletion.
    >
    > Thanks,
    > Tom
    >
     
  4. Tom

    Tom
    Expand Collapse
    Guest

    thanks for the quick response
    can you elaborate on that, or if you can give an example.

    thanks,
    tom
    "Pieter Wijnen" <wijnen.nospam.please@online.no> wrote in message
    news:uzWvsTffGHA.2208@TK2MSFTNGP05.phx.gbl...
    > sure thing
    > add a inputbox to the code & match it
    > Better to assign user rights though
    >
    > Pieter
    >
    > "Tom" <partner1973@yahoo.com> wrote in message
    > news:uRbalMffGHA.4496@TK2MSFTNGP03.phx.gbl...
    >> Hi all,
    >> I have a button on a form that delete records.
    >> Is it possiableto make it password protected?
    >> when the user press it it will ask for password and thenit will continue
    >> with the deletion.
    >>
    >> Thanks,
    >> Tom
    >>

    >
    >
     
  5. Pieter Wijnen

    Pieter Wijnen
    Expand Collapse
    Guest

    Sub Cmd1_Click
    Dim aw as String
    aw=InputBox("Please enter Password")
    if aw <> "secret" then exit sub
    '... delete code
    end sub

    for the other option (security) check out tools /security/ security wizard
    (can't find the msdn KB article at the moment)
    important to backup first...

    Pieter



    "Tom" <partner1973@yahoo.com> wrote in message
    news:uYHMMYffGHA.1792@TK2MSFTNGP03.phx.gbl...
    > thanks for the quick response
    > can you elaborate on that, or if you can give an example.
    >
    > thanks,
    > tom
    > "Pieter Wijnen" <wijnen.nospam.please@online.no> wrote in message
    > news:uzWvsTffGHA.2208@TK2MSFTNGP05.phx.gbl...
    >> sure thing
    >> add a inputbox to the code & match it
    >> Better to assign user rights though
    >>
    >> Pieter
    >>
    >> "Tom" <partner1973@yahoo.com> wrote in message
    >> news:uRbalMffGHA.4496@TK2MSFTNGP03.phx.gbl...
    >>> Hi all,
    >>> I have a button on a form that delete records.
    >>> Is it possiableto make it password protected?
    >>> when the user press it it will ask for password and thenit will continue
    >>> with the deletion.
    >>>
    >>> Thanks,
    >>> Tom
    >>>

    >>
    >>

    >
    >
     
  6. Tom

    Tom
    Expand Collapse
    Guest

    Thank you pieter, this very helpful.
    one more question,
    what if i want to change password ?

    Thanks again,
    Tom
    "Pieter Wijnen"
    <it.isi.llegal.to.send.unsollicited.mail.wijnen.nospam.please@online.replace.with.norway>
    wrote in message news:%23V89VWgfGHA.4776@TK2MSFTNGP05.phx.gbl...
    > Sub Cmd1_Click
    > Dim aw as String
    > aw=InputBox("Please enter Password")
    > if aw <> "secret" then exit sub
    > '... delete code
    > end sub
    >
    > for the other option (security) check out tools /security/ security wizard
    > (can't find the msdn KB article at the moment)
    > important to backup first...
    >
    > Pieter
    >
    >
    >
    > "Tom" <partner1973@yahoo.com> wrote in message
    > news:uYHMMYffGHA.1792@TK2MSFTNGP03.phx.gbl...
    >> thanks for the quick response
    >> can you elaborate on that, or if you can give an example.
    >>
    >> thanks,
    >> tom
    >> "Pieter Wijnen" <wijnen.nospam.please@online.no> wrote in message
    >> news:uzWvsTffGHA.2208@TK2MSFTNGP05.phx.gbl...
    >>> sure thing
    >>> add a inputbox to the code & match it
    >>> Better to assign user rights though
    >>>
    >>> Pieter
    >>>
    >>> "Tom" <partner1973@yahoo.com> wrote in message
    >>> news:uRbalMffGHA.4496@TK2MSFTNGP03.phx.gbl...
    >>>> Hi all,
    >>>> I have a button on a form that delete records.
    >>>> Is it possiableto make it password protected?
    >>>> when the user press it it will ask for password and thenit will
    >>>> continue with the deletion.
    >>>>
    >>>> Thanks,
    >>>> Tom
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
  7. Rick Wannall

    Rick Wannall
    Expand Collapse
    Guest

    To avoid having to change code to change the password, make yourself a
    hidden table. (Create table, mark as hidden object.) Set one field type to
    password. This blocks display of the password. You only need one other
    field, a key field you would use to retrieve the password. Then:

    dim pw as string
    pw = dlookup("Password", "tblPassword", "PWKey='KeyForThisFunction'")
    if me.txtPassword <> pw then
    exit sub
    endif

    There are lots of refinements you can make to this process, but if this is
    good enough then it's good enough.
     
  8. Tom

    Tom
    Expand Collapse
    Guest

    Thanks Rick. I feel we getting there.
    I like the inputBox idea. So if I`ll try to combine:
    Dim aw as String
    dim pw as string
    aw=InputBox("Please enter Password")
    pw = dlookup("Password", "tblPassword", "PWKey='KeyForThisFunction'")
    if aw <> pw then exit sub
    '... delete code
    end sub

    Is that about right?

    Now, I still not sure how the user can change the password.

    Thanks a lot,
    Tom

    "Rick Wannall" <cwannall@yahoo.com> wrote in message
    news:BLucg.24658$Lm5.5606@newssvr12.news.prodigy.com...
    > To avoid having to change code to change the password, make yourself a
    > hidden table. (Create table, mark as hidden object.) Set one field type
    > to password. This blocks display of the password. You only need one
    > other field, a key field you would use to retrieve the password. Then:
    >
    > dim pw as string
    > pw = dlookup("Password", "tblPassword", "PWKey='KeyForThisFunction'")
    > if me.txtPassword <> pw then
    > exit sub
    > endif
    >
    > There are lots of refinements you can make to this process, but if this is
    > good enough then it's good enough.
    >
     
  9. Rick Wannall

    Rick Wannall
    Expand Collapse
    Guest

    Open the table, enter the password. Just don't give a user a way to get to
    the table. YOu can do this with the application deployed and change the
    password any time you see fit.
     
  10. Tom

    Tom
    Expand Collapse
    Guest

    Thank you Rick for your help.
    I got myself really confused and things didn't work for me.
    Now I have a bit more info so I can express my self better.

    1. I think I will not do the inputBox since It will show the password and
    not ****
    2.I created a form txtbox (unbound) and 2 command buttons(OK, CANCEL)
    3.input mask for txtbox is password.
    4.one button is "cancel" - code: DoCmd.close
    5.I created table "tblPass" - one field : password

    From here I`m kinda lost

    1. What code I should put in the OnClick event of the OK button?
    2.What code I should add to the OnClick event of the Delete button ?
    3. I will not be able to change password because I will not be there to do
    that, therefore another person will have to do that, I need a form for him
    to change the password in need.
    4.I would like to have a form with 3 txtbox(input mask -password), old
    password, newpassword, verifynewpassword.
    I think you get the idea.

    Thank you so much for your help and patience,

    Tom



    "Rick Wannall" <cwannall@yahoo.com> wrote in message
    news:rFwcg.13829$fb2.6230@newssvr27.news.prodigy.net...
    > Open the table, enter the password. Just don't give a user a way to get
    > to the table. YOu can do this with the application deployed and change
    > the password any time you see fit.
    >
    >
     
  11. Pieter Wijnen

    Pieter Wijnen
    Expand Collapse
    Guest

    If Your Form is single form linked to a table/query you need to change the
    Cancel button to:

    Private Sub btnCancel_Click()
    If Me.Dirty Then Me.Undo
    Access.DoCmd.Close Access.acForm, Me.Name ' I like to be explicit <g>
    End Sub

    Private Sub btnOK_Click()
    On Error Resume Next
    If Me.Dirty Then
    Me.Dirty = False
    If VBA.Err.Number <> 0 Then
    VBA.MsgBox "An Error occured while saving [" & VBA.Err.Description &
    "]", VBA.vbInformation, "Please rectify"
    Exit Sub
    End If
    End If
    Access.DoCmd.Close Access.acForm, Me.Name
    End If

    Private Sub btnDelete_Click
    ' the check stuff here
    If aw = pw Then
    Access.Docmd.RunCommand Access.acCmdDeleteRecord
    ' Err handling
    End If
    ' etc
    End Sub

    The Password Form:

    Private sub OldPassword_AfterUpdate()

    If Nz(Me!OldPassword,VBA.vbNullstring) <> DlookUp(...) Then
    'Err Msg
    End If
    End Sub

    ' the rest you'll have to figure out ...

    HTH

    Pieter





    "Tom" <partner1973@yahoo.com> wrote in message
    news:uujadpifGHA.3588@TK2MSFTNGP02.phx.gbl...
    > Thank you Rick for your help.
    > I got myself really confused and things didn't work for me.
    > Now I have a bit more info so I can express my self better.
    >
    > 1. I think I will not do the inputBox since It will show the password and
    > not ****
    > 2.I created a form txtbox (unbound) and 2 command buttons(OK, CANCEL)
    > 3.input mask for txtbox is password.
    > 4.one button is "cancel" - code: DoCmd.close
    > 5.I created table "tblPass" - one field : password
    >
    > From here I`m kinda lost
    >
    > 1. What code I should put in the OnClick event of the OK button?
    > 2.What code I should add to the OnClick event of the Delete button ?
    > 3. I will not be able to change password because I will not be there to do
    > that, therefore another person will have to do that, I need a form for him
    > to change the password in need.
    > 4.I would like to have a form with 3 txtbox(input mask -password), old
    > password, newpassword, verifynewpassword.
    > I think you get the idea.
    >
    > Thank you so much for your help and patience,
    >
    > Tom
    >
    >
    >
    > "Rick Wannall" <cwannall@yahoo.com> wrote in message
    > news:rFwcg.13829$fb2.6230@newssvr27.news.prodigy.net...
    >> Open the table, enter the password. Just don't give a user a way to get
    >> to the table. YOu can do this with the application deployed and change
    >> the password any time you see fit.
    >>
    >>

    >
    >
     
  12. scubadiver

    scubadiver
    Expand Collapse
    Guest

  13. Rick Wannall

    Rick Wannall
    Expand Collapse
    Guest

    In the OnClick of the DELETE button, use the DLookup to retrieve the stored
    password, compare what the user typed in, if they match, do your delete.

    Not sure what your cancel button is for. Typically, you use a Cancel button
    on a form that is open in Dialog mode. A Save button does some stuff then
    hides the form, so that the form that opened that form can check the Forms
    collection to notice that the form is still open, just hidden. That's a
    signal for "I did it". The cancel button just closes the form. Not finding
    that form in the Forms collection is the signal for "I cancelled it".

    > 3. I will not be able to change password because I will not be there to do
    > that, therefore another person will have to do that, I need a form for him
    > to change the password in need.


    Yes.

    > 4.I would like to have a form with 3 txtbox(input mask -password), old
    > password, newpassword, verifynewpassword.
    > I think you get the idea.
    >


    You've got it. On this form, let the user type in all 3 values, then use
    the same dlookup technique to retrieve the current password. If that's
    correct, then compare the two for the new password against each other. If
    they match, write the new one back to the table. You can use an update
    query written on the fly for this:

    dim db as DAO.Database
    set db = currentdb
    strSQL = "Update tblPassword Set Password = '" & Me.txtNewPassword & "'
    Where PWKey='KeyForThisFunction"
    db.Execute strSQL
    set db =nothing

    ("Password", "tblPassword", "PWKey='KeyForThisFunction'")
     
  14. Tom

    Tom
    Expand Collapse
    Guest

    Thank you all for your help.
    I created on the form hidden txtbox for password: txtpass.
    the code on the delete button is:
    Dim DelMsg, DelStyle, DelResponse

    DelMsg = "Sorry, wrong password" & vbCrLf & "Can`t let you delete at
    this time."
    DelStyle = vbRetryCancel

    Me.txtpass.Visible = True
    aw = txtpass.Value
    pw = DLookup("Password", "tblPass")

    If aw <> pw Then
    DelResponse = MsgBox(DelMsg, DelStyle)
    If DelResponse = vbRetry Then
    Me.txtpass.Undo
    Else
    Me.txtpass.Visible = False
    Exit Sub

    when I click, I get "Invalid use of Null"

    What is the problem? how do I fix it?

    Thanks a lot,
    Tom



    "scubadiver" <scubadiver@discussions.microsoft.com> wrote in message
    news:F30B4FD6-067C-491E-BF6F-D362459375DE@microsoft.com...
    >
    > have a look at
    >
    > http://www.databasedev.co.uk/button_security.html
    >
    > or
    >
    > http://www.databasedev.co.uk/login.html
    >
    > "Tom" wrote:
    >
    >> Hi all,
    >> I have a button on a form that delete records.
    >> Is it possiableto make it password protected?
    >> when the user press it it will ask for password and thenit will continue
    >> with the deletion.
    >>
    >> Thanks,
    >> Tom
    >>
    >>
    >>
     
  15. Rick Wannall

    Rick Wannall
    Expand Collapse
    Guest

    More than likely your password textbox has nothing in it. You have to test
    for that :

    IsNull(me.txtWhatever)=true

    Then don't do string operations if the control is null.

    IF variable aw is a string type, and the control txtpass is null, then this
    assignment statement will generate the error you report:

    > aw = txtpass.Value
     
  16. Tom

    Tom
    Expand Collapse
    Guest

    Rick,
    Thank you so much.
    "Rick Wannall" <cwannall@yahoo.com> wrote in message
    news:jTIcg.80338$H71.7650@newssvr13.news.prodigy.com...
    > More than likely your password textbox has nothing in it. You have to
    > test for that :
    >
    > IsNull(me.txtWhatever)=true
    >
    > Then don't do string operations if the control is null.
    >
    > IF variable aw is a string type, and the control txtpass is null, then
    > this assignment statement will generate the error you report:
    >
    >> aw = txtpass.Value

    >
    >
    >
     

Share This Page