Hi,
I am attempting to authenticate a password using Dlookup. This doesn’t not have to very secure hence why I am doing it like this.
I want to have an input box appear, the user to type the password and for the script to see if they are permitted to run one query.
This is what I have so far.
Code:
Private Sub tech_approval_Click()
On Error GoTo Err_tech_approval_Click
Dim stDocName As String
Dim Di As Integer
Dim Pass As Integer
'launch user inout box
strPass = InputBox("Please enter your password", "Password")
'query table tech_password and hold the value of tech_id in the variable Result
Result = DLookup("tech_id", "tech_password", "password ='" & strPass & "'")
'query variable result and if it is greater then 1 ie there is a password that matched allow
'to run query tech_approavl
'if tech_id is less than 1 ie no password matched then trutn message box
If (Result < 1) Then
stDocName = MsgBox("Incorrect password", vbExclamation + vbOKOnly, "Error")
MyVar3 = MsgBox(Result)
Else
MyVar4 = MsgBox(Result)
DoCmd.OpenQuery "tech_approval", acViewNormal, acEdit
End If
Exit_tech_approval_Click:
Exit Sub
Err_tech_approval_Click:
MsgBox Err.Description
Resume Exit_tech_approval_Click
End Sub
I am currently only getting the error, "you cancelled the previous operation"
Any help would be much appreciated