Results 1 to 4 of 4
  1. #1
    tngirl is offline Novice
    Windows XP Access 2003
    Join Date
    May 2013
    Posts
    20

    Message for Required Fields in Form

    Hi,

    I am using this code to display a message when a required data entry field is left empty on a data entry form. It is not working though. Any help you can provide is greatly appriecated, thank you.


    Private Sub Form_AfterUpdate()
    If IsNull(Me.Last_Name) Or IsNull(Me.First_Name) Or IsNull(Me.Date) Then
    MsgBox "Please enter Last Name, First Name and Date before saving this record! "
    Cancel = True


    End If
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It needs to be in the before update event:

    http://www.baldyweb.com/BeforeUpdate.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tngirl is offline Novice
    Windows XP Access 2003
    Join Date
    May 2013
    Posts
    20
    Thank you! One more question though, after my message box displays, I get the automatic Access Error Message. is there a way to turn that message off? The message I see is, "you can't go to the specific record". Thank you for your help.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    What is your code now, and under what circumstance does this happen?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 01-12-2014, 02:34 AM
  2. Replies: 8
    Last Post: 09-19-2013, 11:19 AM
  3. Replies: 11
    Last Post: 01-28-2013, 12:11 PM
  4. Creating Required Fields on a form
    By topp in forum Access
    Replies: 4
    Last Post: 06-27-2012, 03:20 PM
  5. Required Fields in a Form
    By Alaska1 in forum Access
    Replies: 3
    Last Post: 12-23-2010, 01:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums