Hi,
I am stuck on what seems to be a fairly simple procedure!
I have written the following code:-
Private Sub pass_AfterUpdate()
'Validate data input - if correct password is entered then open 'Claim form' and if wrong password is entered add a msg box to tell user this password is wrong.
If Me![pass] = "KIRSTY" Then
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Claimform"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
DoCmd.GoToRecord acDataForm, "Claimform",
DoCmd.Close acForm, "password"
ElseIf Me![pass] = "*" Then
MsgBox "This is incorrect! Please try again."
DoCmd.GoToControl "pass"
End If
The ElseIf part doesn't seem to be working.
Basically, I am trying to write code so if any other text apart from kirsty is entered a msgbox appears. I can get this to work, however, I want the previous text entry to have been deleted when the user goesback into the control.
Does anyone out there no how to do this?
Many thanks,
Kirsty.
End Sub
I am stuck on what seems to be a fairly simple procedure!
I have written the following code:-
Private Sub pass_AfterUpdate()
'Validate data input - if correct password is entered then open 'Claim form' and if wrong password is entered add a msg box to tell user this password is wrong.
If Me![pass] = "KIRSTY" Then
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Claimform"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
DoCmd.GoToRecord acDataForm, "Claimform",
DoCmd.Close acForm, "password"
ElseIf Me![pass] = "*" Then
MsgBox "This is incorrect! Please try again."
DoCmd.GoToControl "pass"
End If
The ElseIf part doesn't seem to be working.
Basically, I am trying to write code so if any other text apart from kirsty is entered a msgbox appears. I can get this to work, however, I want the previous text entry to have been deleted when the user goesback into the control.
Does anyone out there no how to do this?
Many thanks,
Kirsty.
End Sub