Run-time Error 2585: Unable to Close Form

  • Thread starter Thread starter Bre-x
  • Start date Start date
B

Bre-x

Hi, I need some help here, no matter what I do I can not close the FS form.

On my FS For I have on single text box (tlogin) and I am using the Enter
event to
to some "systems checks" then launch the Main Form (FMAIN)



Private Sub tlogin_Enter()
On Error GoTo Err_Command_tlogin_Enter

If IsNull(Me.tlogin) = True Then
Exit Sub
End If

var_user = Me.tlogin

'CHECK IF EMP IS ON TC
If emp_is_tc(var_user) = False Then

'EMP IS NOT ON TC
'CHECK IF EMP IS ON DBA
If emp_is_dba(var_user) = False Then
'EMP IS NOT ON DBA, EXIT SUB
Responce = MsgBox("Unable to Find Emp ID. Contact Foreman. ",
vbCritical, " UMCORP")
Exit Sub
End If

'INSERT EMP INTO TIME CLOCK
emp_new (var_user)
End If


'CHECK IF EMP IS IN (SHIFT_START)
If shift_in(var_user) = False Then
shift_start (var_user)
End If

'ALL SYSTEMS CHECKED!!! OPEN MAIN WINDOW
Me.tlogin = Null

DoCmd.OpenForm "FMAIN"
DoCmd.Close acForm, "FS"

Exit_Command_tlogin_Enter:
Exit Sub
Err_Command_tlogin_Enter:
MsgBox Err.Description & " " & Err.Number
Resume Exit_Command_tlogin_Enter
End Sub
 
Bre-x said:
Hi, I need some help here, no matter what I do I can not close the FS
form.

On my FS For I have on single text box (tlogin) and I am using the Enter
event to
to some "systems checks" then launch the Main Form (FMAIN)



Private Sub tlogin_Enter()
On Error GoTo Err_Command_tlogin_Enter

If IsNull(Me.tlogin) = True Then
Exit Sub
End If

var_user = Me.tlogin

'CHECK IF EMP IS ON TC
If emp_is_tc(var_user) = False Then

'EMP IS NOT ON TC
'CHECK IF EMP IS ON DBA
If emp_is_dba(var_user) = False Then
'EMP IS NOT ON DBA, EXIT SUB
Responce = MsgBox("Unable to Find Emp ID. Contact Foreman. ",
vbCritical, " UMCORP")
Exit Sub
End If

'INSERT EMP INTO TIME CLOCK
emp_new (var_user)
End If


'CHECK IF EMP IS IN (SHIFT_START)
If shift_in(var_user) = False Then
shift_start (var_user)
End If

'ALL SYSTEMS CHECKED!!! OPEN MAIN WINDOW
Me.tlogin = Null

DoCmd.OpenForm "FMAIN"
DoCmd.Close acForm, "FS"

Exit_Command_tlogin_Enter:
Exit Sub
Err_Command_tlogin_Enter:
MsgBox Err.Description & " " & Err.Number
Resume Exit_Command_tlogin_Enter
End Sub


When are you thinking that the Enter event fires? It's not when the user
presses the Enter key, if that's what you were thinking. I suspect that you
ought to be using the text box's AfterUpdate event, but maybe there's some
logic behind this that I'm not understanding.
 
Back
Top