hello can you please help me in my registration...my problem is that i don't know how to check if the user input numbers, character, and letters....i want that if the user inputed this in password,example password=jem125@# this will display in my lblvpass="Strong password",if the user input only jem125 it will display to the label "weak password"...can you please help me...hoping for your positive responds...here is my code
Option Explicit
Private con As ADODB.Connection
Private cmd As ADODB.Command
Private user_rs As ADODB.Recordset
Private sql As String, m_user As String
Private Sub Form_Load()
Set con = New ADODB.Connection
Set cmd = New ADODB.Command
Set user_rs = New ADODB.Recordset
With con
.ConnectionString = "provider = microsoft.jet.oledb.4.0; data source =" & App.Path & "\password.mdb" & ";Persist Security Info=false;Jet OLEDB:Database Password=eldenz;"
.Open
End With
Me.Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
End Sub
Private Sub cmdreg_Click()
On Error GoTo cmdreg_Click
If txtRname.Text = "" Then
MsgBox "PLEASE FILL UP THE EMPTY FIELD", vbCritical, "PLEASE FILL UP"
Exit Sub
End If
If txtRpass.Text = "" Then
MsgBox "PLEASE FILL UP THE EMPTY FIELD", vbCritical, "PLEASE FILL UP"
Exit Sub
End If
m_user = Trim(txtRname.Text)
If Len(txtRpass.Text) <> Len(txtrepass.Text) Then
MsgBox "SORRY PASSWORD DID NOT MATCH", vbCritical, "TRY AGAIN..."
Exit Sub
End If
If user_rs.State = adStateOpen Then
user_rs.Close
End If
sql = "select * from security where user_name ='" & m_user & "' "
user_rs.Open sql, con, adOpenDynamic, adLockOptimistic
If user_rs.BOF = True And user_rs.EOF = True Then
With user_rs
.AddNew
!user_name = Trim(txtRname.Text)
!user_pass = Trim(txtRpass.Text)
!rememberYesNo = "No"
.Update
.Close
End With
MsgBox "Congratulations You Are Now Registered", vbInformation, "Successfully Registered"
clear
Else
MsgBox "USER NAME IS ALREADY EXIST", vbCritical, "PLEASE REGISTER AGAIN"
clear
Exit Sub
End If
exit_cmdreg_Click:
Exit Sub
cmdreg_Click:
If Len(txtRname) > 6 Then
MsgBox Err.Description, vbInformation, "Error on your USERNAME"
Exit Sub
End If
If Len(txtRpass) > 6 Then
MsgBox Err.Description, vbInformation, "Error on your PASSWORD"
Exit Sub
End If
If Trim(txtRname) = "'" Then
MsgBox Err.Description, vbExclamation, "THIS IS NOT ALLOWED"
Exit Sub
End If
End Sub
Private Sub clear()
txtRname.Text = ""
txtRpass.Text = ""
txtrepass.Text = ""
lblrepass.Caption = ""
End Sub
Private Sub lblvpass_Click()
End Sub
Private Sub txtrepass_Change()
If Trim(txtRpass.Text) = Trim(txtrepass.Text) Then
lblrepass.Caption = "PASSWORD MATCH"
lblrepass.FontBold = True
lblrepass.FontItalic = False
lblrepass.ForeColor = vbGreen
Else
lblrepass.Caption = "PASSWORD INVALID"
lblrepass.FontItalic = True
lblrepass.ForeColor = vbRed
End If
End Sub
Private Sub txtrepass_Click()
txtrepass.Text = ""
lblrepass.Caption = ""
End Sub
Private Sub txtRname_Change()
lblvuser.Caption = ""
If Len(Trim(txtRname.Text)) > 6 Then
lblvuser.Caption = "PLEASE USE 6 CHARACTERS ONLY.."
End If
End Sub
Private Sub txtRname_Click()
lblvuser.Caption = ""
End Sub
Private Sub txtRpass_Change()
lblvpass.Caption = ""
If Len(txtRpass.Text) > 6 Then
lblvpass.Caption = "PLEASE USE 6 CHARACTERS ONLY.."
txtrepass.Enabled = True
End If
End Sub
Private Sub txtRpass_Click()
lblvpass.Caption = ""
End Sub
Private Sub Label6_Click()
Form15.Show
Unload Me
End Sub
Private Sub cmdcancel_Click()
txtRname.Text = ""
txtRpass.Text = ""
txtrepass.Text = ""
lblrepass.Caption = ""
lblvuser.Caption = ""
lblvpass.Caption = ""
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub