Dim WithEvents adoPrimaryRS As Recordset

Private Sub Command1_Click()
Dim MYCHR As String
Dim LogPassWord As String
On Error GoTo Error_Do


    If Text2.Text = "" Then
        MsgBox "Please Enter your Old Password" & vbCr & "C???C? ?II? C????E C????E C??I??E", vbInformation, "Password"
        Text2.SetFocus
        Exit Sub
    End If
    If Text3.Text = "" Then
        MsgBox "Please Enter your New Password" & vbCr & "C???C? ?II? C????E C????E C??I?IE", vbInformation, "Password"
        Text3.SetFocus
        Exit Sub
    End If
    If Text4.Text = "" Then
        MsgBox "Please Confirm your New Password" & vbCr & "C???C? E???I C????E C????E C??I?IE"
        Text4.SetFocus
        Exit Sub
    End If
    If Text3.Text = M_PassWord Then
        MsgBox "Please Change your New Password" & vbCr & "C????? EU??? C????E C????E C??I?IE", vbInformation, "Password"
        Text3.SetFocus
        Exit Sub
    End If
    If Text4.Text <> Text3.Text Then
        MsgBox "Please Check Confirm Password" & vbCr & "C???C? C?E??I ?? ??E E???I C????E C????E C??I?IE", vbInformation, "Password"
        Text4.SetFocus
        Exit Sub
    End If
    
    For I = 1 To Len(Trim(Text2.Text))
    MYCHR = Mid(Text2.Text, I, 1)
    If MYCHR = "1" Then
       LogPassWord = LogPassWord + "C"
    ElseIf MYCHR = "2" Then
       LogPassWord = LogPassWord + "M"
    ElseIf MYCHR = "3" Then
       LogPassWord = LogPassWord + "Y"
    ElseIf MYCHR = "4" Then
       LogPassWord = LogPassWord + "E"
    ElseIf MYCHR = "5" Then
       LogPassWord = LogPassWord + "U"
    ElseIf MYCHR = "6" Then
       LogPassWord = LogPassWord + "K"
    ElseIf MYCHR = "7" Then
       LogPassWord = LogPassWord + "S"
    ElseIf MYCHR = "8" Then
       LogPassWord = LogPassWord + "D"
    ElseIf MYCHR = "9" Then
       LogPassWord = LogPassWord + "F"
    ElseIf MYCHR = "0" Then
       LogPassWord = LogPassWord + "G"
    End If
  Next
  
   Set adoPrimaryRS = New Recordset
   adoPrimaryRS.Open "select * from USERS WHERE TRIM(USER_ID) ='" & Trim(Text1.Text) & "' AND TRIM(PASS_WORD)='" & Trim(LogPassWord) & "'", CNN, adOpenDynamic, adLockPessimistic
   If adoPrimaryRS.RecordCount = 0 Then
      MsgBox "Error..?? Please Check your Userid and Password" & vbCr & "C???C? C?E??I ?? ??E ??? C????E ? C????E C????E", vbExclamation, "Login Error"
      Text2.SetFocus
      Exit Sub
   Else
   LogPassWord = ""
    For I = 1 To Len(Trim(Text3.Text))
      MYCHR = Mid(Text3.Text, I, 1)
      If MYCHR = "1" Then
       LogPassWord = LogPassWord + "C"
      ElseIf MYCHR = "2" Then
       LogPassWord = LogPassWord + "M"
      ElseIf MYCHR = "3" Then
       LogPassWord = LogPassWord + "Y"
      ElseIf MYCHR = "4" Then
       LogPassWord = LogPassWord + "E"
      ElseIf MYCHR = "5" Then
       LogPassWord = LogPassWord + "U"
      ElseIf MYCHR = "6" Then
       LogPassWord = LogPassWord + "K"
      ElseIf MYCHR = "7" Then
       LogPassWord = LogPassWord + "S"
      ElseIf MYCHR = "8" Then
       LogPassWord = LogPassWord + "D"
      ElseIf MYCHR = "9" Then
       LogPassWord = LogPassWord + "F"
      ElseIf MYCHR = "0" Then
       LogPassWord = LogPassWord + "G"
      End If
    Next
    
    adoPrimaryRS!Pass_Word = LogPassWord
    adoPrimaryRS.UpdateBatch adAffectAll
    adoPrimaryRS.Close
     
    ' sndPlaySound App.Path & "\WRITING.wav", 1
    ' CNN.Close
    MsgBox "Ok..   Your Password have been Chenged" & vbCr & "??I E? EU??? C????E C????E E??C?", vbInformation, "Add Password"
    Unload Me
   End If
 Exit Sub
Error_Do:
MsgBox Err.Description
Unload Me
End Sub

Private Sub Command2_Click()
' CNN.Close
Unload Me
End Sub

Private Sub Form_Load()
On Error GoTo Err_DO
ShadeForm Me, 2
Text1.Text = M_Userid
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
   Set CNN = New Connection
   CNN.CursorLocation = adUseClient
   CNN.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=" & DB_Path & ";"
   Exit Sub
   
Err_DO:
MsgBox Err.Description
Command1.Enabled = False
End Sub

Private Sub Form_Unload(Cancel As Integer)
ScrollForm Me
Screen.MousePointer = vbDefault
End Sub

Private Sub text2_KeyPress(KeyAscii As Integer)
Dim MYFIELD As String
MYFIELD = "0123456789"
If KeyAscii = 13 Then
SendKeys "{TAB}"
KeyAscii = 0
End If

If KeyAscii > 26 Then
  If InStr(MYFIELD, Chr(KeyAscii)) = 0 Then
   KeyAscii = 0
  End If
End If
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
Dim MYFIELD As String
MYFIELD = "0123456789"
If KeyAscii = 13 Then
SendKeys "{TAB}"
KeyAscii = 0
End If

If KeyAscii > 26 Then
  If InStr(MYFIELD, Chr(KeyAscii)) = 0 Then
   KeyAscii = 0
  End If
End If
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Private Sub Text4_KeyPress(KeyAscii As Integer)
Dim MYFIELD As String
MYFIELD = "0123456789"
If KeyAscii = 13 Then
SendKeys "{TAB}"
KeyAscii = 0
End If

If KeyAscii > 26 Then
  If InStr(MYFIELD, Chr(KeyAscii)) = 0 Then
   KeyAscii = 0
  End If
End If
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub


