Hello All.
I am getting my error on an Insert SQL statement in VBA. It is bombing on the value for strPWH. I can see that the value for strPWH is valid (e.g. "a%¬ßÙÒ×wx^¨´m¤ "ès•‚›ÏÖ—à1¤fuÄ ÏD "), and if I just use Debug.Print for the string, and then put that in instead of the strPWH, it works fine.
Here is my sub...
	Any thoughts?
Thanks!
					I am getting my error on an Insert SQL statement in VBA. It is bombing on the value for strPWH. I can see that the value for strPWH is valid (e.g. "a%¬ßÙÒ×wx^¨´m¤ "ès•‚›ÏÖ—à1¤fuÄ ÏD "), and if I just use Debug.Print for the string, and then put that in instead of the strPWH, it works fine.
Here is my sub...
Code:
	Private Sub txtPW_AfterUpdate()
    Dim strUser As String
        strUser = Me.txtUser
    Dim intAccLev As Integer
    
    If Me.txtPW = "" Or Me.txtUser = "" Then 'Checks for an entered username and password
        MsgBox ("You must enter a username and password"), vbOKOnly, "Incomplete"
        Exit Sub
    End If
    
    Call PRNG
    Call StrToHashToStr(Me.txtPW)
    
    If MsgBox("Will this user perform admin functions on DB?", vbYesNo, "Admin?") = vbYes Then 'User is an Admin for DB
        intAccLev = 2
    Else
        intAccLev = 1
    End If
     
    DoCmd.SetWarnings False
    DoCmd.RunSQL "INSERT INTO tblUsers (UserName, PW, Na, AccLev, Active, Prelim ) " & _
                    "SELECT '" & strUser & "', '" & strPWH & "', '" & strNa & "', " & intAccLev & ", " & _
                    True & ", " & True & " FROM tblUsers"  '1st True is Active/Inactive, and 2nd True is Prelim
    DoCmd.SetWarnings True
End Sub
Thanks!
 
	 
	 
	
Comment