Delete form button help

viperstingray

Registered User.
Local time
Today, 11:30
Joined
May 31, 2005
Messages
87
Hello

I currently have a button that holds a delete command. When the button is clicked, a MsgBox pops up and ensures that you want to delete (yes and no); Yes deletes, No cancels.

Now I need to change it around a bit so that it is more secure. I would like add an 'authorization' code (password). When the msgbox appears, I would like it to have a text box where the user needs to enter in the password, if the password is correct then it would delete, if wrong then cancel.

I need help. I finish my contract tomorrow and this is all I have left

thank you
 
One way would be to make the delete button open a pop-up form where the user has to enter the password then say OK. It could then be checked, if wrong just exit, if right continue to the "are you sure?" jobbie

Col
 
Hello viper!
Look at "DemoDelPaswordA2000.mdb"
Open form1 and try.
 

Attachments

I already thought of that way but ran into trouble when the program tried to do the delete command. Is there a way I can do it in a msgbox. PLEASE. I know that I will not be able to 'mask*****' the password in a msgbox but that is what they want and I am stuck.
 
Hello viper!
In my Demo there no button, try with Delete icon.
 
Code:
Private Sub bDeleteRecord_Click()
On Error GoTo Err_bDeleteRecord_Click
    
    Dim strInput As String
    Dim strMsg As String
   
    Beep
    strMsg = "Please key the Delete Password to allow the deletion of the current record."
    strInput = InputBox(Prompt:=strMsg, Title:="Delete Password")
    If strInput = "[COLOR=Blue]YourPasswordHere[/COLOR]" Then
        Beep
        DoCmd.RunCommand acCmdDeleteRecord
        Refresh
            Else
            Beep
            MsgBox "Incorrect Password!" & Chr(13) & Chr(13) & "You are not allowed to delete any table records." & Chr(13) & Chr(13) & "Please contact your database administrator for help.", vbCritical, "Invalid Password"
        Exit Sub
    End If
    
Exit_bDeleteRecord_Click:
    Exit Sub

Err_bDeleteRecord_Click:
    MsgBox Err.Number & " " & Err.Description
    Resume Exit_bDeleteRecord_Click

End Sub
 
MStef

That is perfect...but sadly, I NEED TO HAVE IT IN A COMMAND BUTTON. Is there anyway that your code can be modified to be held in a command button
 

Users who are viewing this thread

Back
Top Bottom