Prev: Report Totals
Next: Access - update existing table
From: Bre-x on 17 May 2010 11:33 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
From: Dirk Goldgar on 17 May 2010 12:57 "Bre-x" <cholotron(a)hotmail.com> wrote in message news:%23rcHXZd9KHA.980(a)TK2MSFTNGP04.phx.gbl... > 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)
From: Bre-x on 17 May 2010 13:29 Thank you!!! I change my code to the AfterUpdate event and everything is working fine!!!! "Dirk Goldgar" <dg(a)NOdataSPAMgnostics.com.invalid> wrote in message news:ez8tBIe9KHA.4924(a)TK2MSFTNGP04.phx.gbl... > "Bre-x" <cholotron(a)hotmail.com> wrote in message > news:%23rcHXZd9KHA.980(a)TK2MSFTNGP04.phx.gbl... >> 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) >
|
Pages: 1 Prev: Report Totals Next: Access - update existing table |