Solved

Access Required Fields

Posted on 2014-04-25
2
247 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
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…

860 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