If Text1 = "" Or Text2 = "" Then MsgBox " Sorry,You Must Type The Username And Password ", vbCritical + vbMsgBoxRight, " ErrorLogin " Exit Sub End If SQLs = "SELECT * FROM Users WHERE UserName ='" & Text1.Text & "' and Password='" & Text2.Text & "'" If RS.State = adStateOpen Then RS.Close RS.Open SQLs, DB, adOpenKeyset, adLockPessimistic
If RS.EOF Then MsgBox " Sorry, The Username And Password Is Wrong ! ", vbCritical + vbMsgBoxRight, " Error Login " Else ' Save This Inforamtion UserNames = Text1 UserPassword = Text2 Set RS = Nothing Set DB = Nothing MDIForm1.Show Unload Me End If