Hi....
I have the Code in the After update event in the but getting error:---
Codes are :-
Code Tags Added by UG
Please use Code Tags when posting VBA Code
Please read this for further information:-
Please feel free to Remove this Comment
I have the Code in the After update event in the but getting error:---
Codes are :-
Code Tags Added by UG
Please use Code Tags when posting VBA Code
Please read this for further information:-
Please use Code Tags when posting VBA Code
To make your code easier to read, please use the Code tag around your code, this will ensure that any code you copy and paste from your DB retains it's formatting making it easier to read and follow; Firstly click on the Code button, that's the button at the top of the posting window with the...
www.access-programmers.co.uk
Code:
Private Sub Command3_Click()
If IsNull(TXTNAME.Value) = True Or TXTNAME.Value = "" Then
MsgBox "User Name Cannot be Blank", vbOKOnly + vbInformation, "Information Required"
TXTNAME.SetFocus
Exit Sub
End If
If IsNull(Me.TXTID.Value) = True Or TXTID.Value = "" Then
MsgBox "User ID Cannot be Blank", vbOKOnly + vbInformation, "Information Required"
TXTID.SetFocus
Exit Sub
End If
If IsNull(Me.TXTPASSWORD.Value) = True Or TXTPASSWORD.Value = "" Then
MsgBox "Please enter password", vbOKOnly + vbInformation, "Information Required"
TXTPASSWORD.SetFocus
Exit Sub
End If
If IsNull(Me.COMROLE.Value) = True Or COMROLE.Value = "" Then
MsgBox "Please Select Role", vbOKOnly + vbInformation, "Information Required"
COMROLE.SetFocus
Exit Sub
End If
'check
Dim NewACCTNO As String
Dim stLinkCriteria As String
Dim acctno1 As Integer
NewACCTNO = Me.TXTID.Value
stLinkCriteria = "[UserName] = " & "'" & NewACCTNO & "'"
If Me.TXTID = DLookup("[UserName]", "tblUsers", stLinkCriteria) Then
MsgBox "User ID:(" & NewACCTNO & "), is an existing User, " _
& vbCr & vbCr & "Use any other ID", vbInformation, "HELLO USER.... DUPLICATE INFORMATION"
Me.TXTID.Value = ""
Me.TXTID.SetFocus
Exit Sub
End If
If ValidatePwd1(TXTPASSWORD.Value) = 0 Then
MsgBox "Worng Password, password should:-" & vbCrLf & "(1) Contain 8 to 16 Characters" _
& vbCrLf & "(2) Should contain at least, a Number, one Capital Letter, one Small Letter, and a Special Character" _
& vbCrLf & "Enter the Password again!!! ", vbOKOnly + vbInformation, "Password Verification"
TXTPASSWORD.SetFocus
TXTCNF.Value = ""
Exit Sub
End If
If Me.TXTPASSWORD.Value <> Me.TXTCNF.Value Then
MsgBox "Password Miss-matched, Confirm the Password again", vbOKOnly + vbCritical, "PASSWORD VALLIDATION"
Me.TXTCNF.SetFocus
Exit Sub
End If
'------
Dim rs As ADODB.Recordset (Here I am getting error Compile error User Defined type not defined)
Set rs = New ADODB.Recordset
rs.Open "tblUsers", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
With rs
.AddNew
![Uname] = Me.TXTNAME.Value
![UserName] = Me.TXTID.Value
![Password] = Me.TXTPASSWORD.Value
![Role] = Me.COMROLE.Value
.Update
rs.Close
Set rs = Nothing
End With
MsgBox "Registration of the New User has been successfully done!!!!" & VCrlf & "Congratulations!", vbOKOnly + vbInformation, "New Registraion"
DoCmd.Close acForm, "Register Form USER"
'DoCmd.OpenForm "frmlogin"
End Sub
Last edited by a moderator: