A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Run-time Error 2585: Unable to Close Form



 
 
Thread Tools Display Modes
  #1  
Old May 17th, 2010, 04:33 PM posted to microsoft.public.access.gettingstarted
Bre-x
external usenet poster
 
Posts: 103
Default Run-time Error 2585: Unable to Close Form

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


  #2  
Old May 17th, 2010, 05:57 PM posted to microsoft.public.access.gettingstarted
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Run-time Error 2585: Unable to Close Form

"Bre-x" wrote in message
...
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.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

  #3  
Old May 17th, 2010, 06:29 PM posted to microsoft.public.access.gettingstarted
Bre-x
external usenet poster
 
Posts: 103
Default Run-time Error 2585: Unable to Close Form

Thank you!!!

I change my code to the AfterUpdate event and everything is working fine!!!!





"Dirk Goldgar" wrote in message
...
"Bre-x" wrote in message
...
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.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:28 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.