Password Authenticated but logon form not closing

nooner

Registered User.
Local time
Today, 15:44
Joined
Feb 27, 2003
Messages
11
I have a logon form that checks user id and password, once you click the login button a new form should open called "frmWelcome" and the "logon” form should close.The problem is that when a users password is authenticated the welcome form opens but the logon form does not close behind it. I would appreciate any suggestions as to how to overcome this problem.I will attach the code causing the problems, thank you in advance.
'Check value of password in tblEmployees to see if this
'matches value chosen in combo box

If Me.txtPassword.Value = DLookup("strEmpPassword", _
"tblEmployees", "[lngEmpID]=" & Me.cboEmployee.Value) Then

lngMyEmpID = Me.cboEmployee.Value

'Close logon form and open welcome screen

DoCmd.Close acForm, "Logon", acSaveNo
DoCmd.OpenForm "frmWelcome"




Else
MsgBox "Password Invalid. Please Try Again", _
vbOKOnly, "Invalid Entry!"
Me.txtPassword.SetFocus
End If
 
Try the plain close command:

DoCmd.Close
DoCmd.OpenForm "frmWelcome"
 
When I placed the DoCmd.Close line in the code, I got the following error message "The action cant be carried out while processing a form or report event".
The reason for this may be that when the user logs on they must select a department(from a field also on the log on form) and based on their department some forms that are also in the program, are visible to the user and others are not based on the department they selected, is there any way to workaround this fact and still close the form?.Thanks again for your prompt and helpful response.
 
Why not close the logon form with the on open event of frmWelcome?
 
You should open the welcome form first, then close the logon form.

DoCmd.OpenForm "frmWelcome"
DoCmd.Close acForm, "Logon", acSaveNo

HTH
 

Users who are viewing this thread

Back
Top Bottom