Clayhead22
Registered User.
- Local time
- Today, 15:07
- Joined
- Feb 22, 2015
- Messages
- 36
Hi All
I have built a string of VBA code to reset a password if the user enters all of the correct details. This part works fine. The issue is that if the incorrect details are entered instead of retunring a MsgBox saying incorrect details enterd, it returns an access error Run-time error 3075. Code is below. please please please can someone help?
I have built a string of VBA code to reset a password if the user enters all of the correct details. This part works fine. The issue is that if the incorrect details are entered instead of retunring a MsgBox saying incorrect details enterd, it returns an access error Run-time error 3075. Code is below. please please please can someone help?
Code:
Private Sub Reset_Password_Click()
Dim sSql As String
If IsNull(Me.Username) Then
MsgBox "Username Required!"
Else
If IsNull(Me.Date_Of_Birth) Then
MsgBox "Date of Birth Required"
Else
If IsNull(Me.Email) Then
MsgBox "Email Address Required"
Else
If IsNull(Me.Mobile) Then
MsgBox "Mobile Number Required"
Else
If IsNull(Me.Post_Code) Then
MsgBox "Post Code Required"
Else
If IsNull(Me.New_Password) Then
MsgBox "New Password Required"
Else
If IsNull(Me.Confirm_Password) Then
MsgBox "Password Re-Enter Required"
Else
If (IsNull(DLookup("[Username]", "Users", "[Username] ='" & Me.Username.Value & "' And [Date of Birth] = #" & Me.Date_Of_Birth & "# And [Email] = '" & Me.Email.Value & "' And [Mobile] = '" & Me.Mobile.Value & "' And [Postal Code] = '" & Me.Post_Code.Value & "'"))) Then
MsgBox "Incorrect Details Entered"
Else
sSql = "Update Users Set [Password] = '" & Me.New_Password & "' WHERE [Username] = '" & Me.Username & "' ;"
CurrentDb.Execute sSql, dbSeeChanges
MsgBox "Password Changed"
DoCmd.Close
DoCmd.OpenForm "Login"
End If
End If
End If
End If
End If
End If
End If
End If
End Sub