Option Explicit Public LoginSucceeded As Boolean Private Sub cmdCancel_Click() 'set the global var to false 'to denote a failed login LoginSucceeded = False Me.Hide End Sub Private Sub cmdOK_Click() rs.Open "SELECT * FROM Member ", con, adOpenDynamic, adLockReadOnly While Not rs.EOF If rs!MemberID = Val(txtUserID) Then 'check for correct password' If rs!Pass = txtPassword Then 'place code to here to pass the ' 'success to the calling sub' 'setting a global var is the easiest' LoginSucceeded = True frmMENU.Show Me.Hide con.Close Exit Sub Else MsgBox "Invalid Password, try again!", , "Login" txtPassword.SetFocus SendKeys "{Home}+{End}" End If End If rs.MoveNext Wend End Sub Private Sub Form_Load() Call loadcon End Sub
rs.Open
rs.Close
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)