[AccessD] Error Closing Form

Gary Kjos garykjos at hotmail.com
Thu Feb 5 14:09:55 CST 2004


Did you comment out any "on error" statement so it stops an the error line? 
What line is it failing on?



Gary Kjos
garykjos at hotmail.com





>From: "Hollis,Virginia" <HollisVJ at pgdp.usec.com>
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: "'Access Developers discussion and problem solving'" 
><accessd at databaseadvisors.com>
>Subject: [AccessD] Error Closing Form
>Date: Thu, 05 Feb 2004 11:32:21 -0600
>
>I have the code shown below on a command button that closes a form. The 
>form
>is a data entry form with a checkbox that will cancel the request by
>changing the status to 3 (canceled). If the status = canceled then the form
>will close. If an entry has been made on the form, there are certain
>required fields that must be completed before closing.
>
>Problem: Everything works fine except when I check the Cancel box. The
>status changes from 1 (Pending) to 3 (Canceled) & the form will close, but 
>I
>get an error, "Can't find frmPermitEntry refered to in a macro of visual
>basic code".
>
>I tried commenting out different sections of the code, but I can't find the
>problem. What I don't understand, I have used this same code before without
>any problems. What am I missing?
>
>********************
>
>If PStatusID = 3 Then DoCmd.Close 'Request has been canceled
>
>If Forms!frmPermitEntry.Dirty = True Then    'Data Entered?  Yes
>    If Len(PRequestorID & "") = 0 Then
>         MsgBox "A requestor must be entered." & vbCrLf, vbCritical, " 
>Entry
>Required"
>         PRequestorID.SetFocus
>     ElseIf Len(PNeedByDate & "") = 0 Then
>         MsgBox "The date needed must be entered." & vbCrLf, vbCritical, "
>Entry Required"
>         PNeedByDate.SetFocus
>     ElseIf Len(PTypeWork & "") = 0 Then
>         MsgBox "The type of work must be entered." & vbCrLf, vbCritical, "
>Entry Required"
>         PTypeWork.SetFocus
>
>     Else
>
>          Response = MsgBox("Do you want to Exit?", vbYesNo + vbQuestion,
>"Exit")
>          If Response = vbNo Then
>            PRequestorID.SetFocus
>          Else
>              DoCmd.RunCommand acCmdSaveRecord
>             DoCmd.Close acForm, "frmPermitEntry"
>          End If
>       End If
>
>Else
>    DoCmd.Close acForm, "frmPermitEntry"
>End If
>_______________________________________________
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com

_________________________________________________________________
Check out the new MSN 9 Dial-up — fast & reliable Internet access with prime 
features! http://join.msn.com/?pgmarket=en-us&page=dialup/home&ST=1



More information about the AccessD mailing list