Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access Required Fields

Posted on 2014-04-25
2
Medium Priority
?
264 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 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 total points
ID: 40022456
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
ID: 40022515
Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Suggested Courses

885 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