Quote:
Originally posted by greysquirl
OK. . .I tried using the code you sent me and here is the problem. Under the Select Case you have this "ValidateUser" thing goin on. When I start the program it gives me this error when I click on the OK button. "Compile Error. . . .Sub or Function not defined". What am I doing wrong? And what else might I need to do? Remember that this is my first program ever and I am self taught. . .obviosly not well enough, but anyways. Plaese help. Thank You.
I have a table called [Security], and in it are two fields called [Username] & [Password]. I my login screen I have Username & Password text boxes that both look to the Data1 Recorset which in turn looks to the database. I hope this helps.
Private Sub cmdCancel_Click()
End
End Sub
Private Sub CmdOK_Click()
'On your CmdOK_Click event of the login screen.
Select Case ValidateUser(txtUserName, txtPassword)
Case 0
MsgBox "Successful Login.", vbOKOnly + vbInformation, "Logon"
Me.Hide
frmMain.Show
Case 4
MsgBox "Successful Login", vbInformation + vbOKOnly, "Logon"
Me.Hide
frmMain.Show
Case 1
MsgBox "Invalid User ID.", vbInformation + vbOKOnly
txtUserName.SetFocus
Case 2
MsgBox "Invalid User Password.", vbInformation + vbOKOnly
txtPassword.SetFocus
End Select
End Sub