Creating a Password Generation form : (Problem) (1 Viewer)

sbaud2003

Member
Local time
Today, 17:48
Joined
Apr 5, 2020
Messages
172
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

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:

theDBguy

I’m here to help
Staff member
Local time
Today, 05:18
Joined
Oct 29, 2018
Messages
21,358
Hi. Do you have a reference set for ADO?
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:18
Joined
Sep 21, 2011
Messages
14,051
Check your references in the VBE window.
Alt+F11 then Tools/References

I expect you need 'Microsoft Active Data Objects' library?

Just guessing from the acronym ADO ?

 

onur_can

Active member
Local time
Today, 05:18
Joined
Oct 4, 2015
Messages
180
It is better to use DAO instead of ADODB
 

sbaud2003

Member
Local time
Today, 17:48
Joined
Apr 5, 2020
Messages
172
Hi. Do you have a reference set for ADO?
Yah... Probably dut to that
Noe I have Changed to DAO its working fine..... Thanks
Actualy I dont know much difference about both....
but now i think DAO is better
Thanks any way
 

onur_can

Active member
Local time
Today, 05:18
Joined
Oct 4, 2015
Messages
180
I do not encounter any problems when I use DAO.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:18
Joined
Oct 29, 2018
Messages
21,358
Yah... Probably dut to that
Noe I have Changed to DAO its working fine..... Thanks
Actualy I dont know much difference about both....
but now i think DAO is better
Thanks any way
Hi. You're welcome. Good luck with your project.
 

Users who are viewing this thread

Top Bottom