[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Date Validation and accepting null values on Access Forms

Posted on 2014-03-21
3
Medium Priority
?
281 Views
Last Modified: 2014-06-06
Hi

I have an issue with some code behind a form, which previously worked but seem to break now.  The 3 dates on the form are defaulted and users can also manually edit it too in the field directly.  The 3 dated validate each other and the recording date has to be between the time started and time signed.

(1) Seems to be a problem with with dates manually entered through the input mask for DD/MM/YYYY HH:MM  ie 99\99\9999/99:99:0...  The criteria berow fails as macro cannot recognise a date format.

(2)  If I insert a CDate() for each field return, there will be a problem dealing with Null Values which should be accepted

Is there a better way of running these validations and also ignoring null values?

'If Me.txtTimeRecorded <> "" Then
'    If Me.txtTimeRecorded < Me.txtTimeStarted Then
'            MsgBox ("The Recorded Time can not be before the Start Time")
'            blnexit = True
'    End If
'    If Me.txtTimeRecorded > Me.txtTimeSigned Then
'            MsgBox ("The Recorded Time can not be after the Time Signed")
'            blnexit = True
'    End If
'End If
0
Comment
Question by:yasanthax
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Gustav Brock earned 1200 total points
ID: 39945037
Use CVDate in place of CDate. It accepts Nulls.

/gustav
0
 

Author Closing Comment

by:yasanthax
ID: 40116963
Thanks.  I did not know about this function and seems to fix it.
0
 
LVL 52

Expert Comment

by:Gustav Brock
ID: 40116966
You are welcome!

/gustav
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

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…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

650 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