I broke my new user login form. I removed the uLogonCount from the tblUsers and from the below strSQL code and now whenever the New User form comes up I get the following error;
Number of query values and destination fields are not the same.
I also added a few columns to the tblUser table. So maybe that is why, but I don't think so.
Number of query values and destination fields are not the same.
I also added a few columns to the tblUser table. So maybe that is why, but I don't think so.
Code:
Option Compare Database
Option Explicit
Private Sub cmdContinue_Click()
On Error GoTo ErrHandler
Dim strSQL As String
If Nz(Me.txtFirstName, "") = "" Then
MsgBox ("First Name cannot be empty.")
DoCmd.GoToControl "txtFirstName"
Exit Sub
End If
If Nz(Me.txtLastName, "") = "" Then
MsgBox ("Last Name cannot be empty.")
DoCmd.GoToControl "txtLastName"
Exit Sub
End If
If Nz(Me.txteMail, "") = "" Then
MsgBox ("Email cannot be empty.")
DoCmd.GoToControl "txteMail"
Exit Sub
End If
DoCmd.SetWarnings False
strSQL = "INSERT INTO tblUsers ( uNetworkID, uFirstName, uLastName, ueMail, uLastLogon, uSecurityID, uActive )" & _
" Values ('" & Environ("UserName") & "' , '" & Me.txtFirstName & "', '" & Me.txtLastName & "', '" & Me.txteMail & "', Now(), 1, 9, True )"
DoCmd.RunSQL strSQL
Forms("frmPrivAct").Tag = "Continue"
DoCmd.Close acForm, Me.Name
Complete:
Exit Sub
ErrHandler:
MsgBox ("Error creating user profile: " & Err.Description)
End Sub