[mso] Re: Access 2002: Checking For Nulls On Form Close :VSMail mx1

  • From: James LaBorde <jlaborde@xxxxxxxxx>
  • To: "'mso@xxxxxxxxxxxxx'" <mso@xxxxxxxxxxxxx>
  • Date: Thu, 10 Jun 2004 14:58:37 -0700

Cathy,

Don't forget to give your users an out.  They may decide they don't want to
enter a new form after all and need to exit, you could do this on your
BeforeUpdate as well.  This will allow the user the option to select Cancel
on the message box to exit the form cleanly or OK to return to the form and
set the focus on the appropriate field.

James

**********Begin Code**************
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim Response as string

    If Nz(Me!Project, "") = "" Then
        Response = MsgBox "Please fill in Project Number", vbOKCancel +
vbExclamation, "Must Complete Information!"
        If Response = vbOK Then
                Me!Project.SetFocus
          ElseIf Response = vbCancel Then
                Cancel = True
                Me.Undo
          End If
        Exit Sub
    End If
    If Nz(Me!Type, "") = "" Then
        Response = MsgBox "Please fill in Order Type", vbOKCancel +
vbExclamation, "Must Complete Information!"
        If Response = vbOK Then
                Me!Type.SetFocus
          ElseIf Response = vbCancel Then
                Cancel = True
                Me.Undo
          End If
        Exit Sub    End If
    If Nz(Me!DateIssue, "") = "" Then
        Response = MsgBox "Please fill in Issue Date", vbOKCancel +
vbExclamation, "Must Complete Information!"
        If Response = vbOK Then
                Me!DateIssue.SetFocus
          ElseIf Response = vbCancel Then
                Cancel = True
                Me.Undo
          End If
    End If
End Sub

************End Code****************


-----Original Message-----
From: Cathy.Evans@xxxxxxxxx [mailto:Cathy.Evans@xxxxxxxxx]
Sent: Thursday, June 10, 2004 2:01 PM
To: mso@xxxxxxxxxxxxx
Subject: [mso] Re: Access 2002: Checking For Nulls On Form Close :VSMail
mx1



>>>Can you post your code and we can try to help you troubleshoot why it is
popping up  the first message box<<<

Here it is, thank you!


Private Sub Form_BeforeUpdate(Cancel As Integer)
    If Nz(Me!Project.SetFocus, "") = "" Then
        MsgBox "Please fill in Project Number", vbOKOnly + vbExclamation,
"Must Complete Information!"
        Me!Project.SetFocus
        Cancel = True
        Me.Undo
        Exit Sub
    End If
    If Nz(Me!Type.SetFocus, "") = "" Then
        MsgBox "Please fill in Order Type", vbOKOnly + vbExclamation, "Must
Complete Information!"
        Me!Type.SetFocus
        Cancel = True
        Me.Undo
        Exit Sub
    End If
    If Nz(Me!DateIssue.SetFocus, "") = "" Then
        MsgBox "Please fill in Issue Date", vbOKOnly + vbExclamation, "Must
Complete Information!"
        Me!DateIssue.SetFocus
        Cancel = True
        Me.Undo
    End If
End Sub





----------------------------------------------------------------------------
-------------------------
The information transmitted is intended only for the person
or entity to which it is addressed and may contain confidential
and/or privileged material. If you are not the intended recipient 
of this message you are hereby notified that any use, review,
retransmission, dissemination, distribution, reproduction or any
action taken in reliance upon this message is prohibited. If you 
received this in error, please contact the sender and delete the 
material from any computer.  Any views expressed in this message
are those of the individual sender and may not necessarily reflect 
the views of the company.  
----------------------------------------------------------------------------
---------------------------

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes)
in the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also
allow you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation
with instructions.  Once you are a member of the files group, you can go
here to upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: