Solved

Access VBA Null String Date Field

Posted on 2007-11-19
4
2,944 Views
Last Modified: 2012-08-14
Hi,

Can someone tell me how I would check a text field of mine, which has an input mask of date, for null values. I usually do the following;

If Nz(Me(TextDateFrom), "") = vbNullString Then

But for some reason it is saying MS Office cant find the field "01/11/2007" (Which is the value in the field, not the field itself).
0
Comment
Question by:andyb7901
4 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 20311641
you need " " around the control name.
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 200 total points
ID: 20311654
Why dont you just do

me.TextDateForm

0
 
LVL 44

Assisted Solution

by:Arthur_Wood
Arthur_Wood earned 200 total points
ID: 20311856
the (...) around the field name cause that value to be evaluted, hence you are seeing 01/11/2007  rather than the name for the field.  Your code should read:

If Nz(Me.TextDateFrom, "") = vbNullString Then

AW
0
 
LVL 49

Assisted Solution

by:Gustav Brock
Gustav Brock earned 100 total points
ID: 20313597
You could/should check for Null directly:

If IsNull(Me!TextDateFrom.Value) Then

/gustav
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
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…
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.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

760 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

19 Experts available now in Live!

Get 1:1 Help Now