Solved

Access Required Fields

Posted on 2014-04-25
2
241 Views
Last Modified: 2014-04-25
I'm using the following code and it works fine for the most part, however it allows the user to move to the next record after the second  attemp without entering the date resolved. How do I require the user to enter the date resolved before moving to the next record.

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Not IsNull(Me.ResolveCode) And IsNull(Me.DateResolved) Then
MsgBox "Please enter the Date Resolved", vbExclamation, "FSB GovTrip"

        Me.DateResolved.SetFocus
       
       Exit Sub
    End If

   
 
 
End Sub
0
Comment
Question by:shieldsco
2 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
Comment Utility
Do:

Cancel = True

which tells Access to cancel the update of the control.   No need to do the set focus.  The focus will remain on the control.

Jim.
0
 

Author Closing Comment

by:shieldsco
Comment Utility
Thanks
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now