Check for Null Date

J

John Conklin

Hello all,

I have a form that populates dates on a subform based on the current status
value.

On opening the form I want to check the current status and the corresponding
date field, and if the date field is blank put today's date in.

How do I check for a blank date field? Here is part of my code:

If Me.Current_Status = "Issue Assignment" And
Forms![frmIssueLog]![frmStatusTimes].Form![IssueAssignBegin] = "" Then
Forms![frmIssueLog]![frmStatusTimes].Form![IssueAssignBegin] =
Date

Any and all help is greatly appreciated.

Thanks,
~John
 
A

Arvin Meyer

Instead of:

Forms![frmIssueLog]![frmStatusTimes].Form![IssueAssignBegin] = ""

Try:

Len(Forms![frmIssueLog]![frmStatusTimes].Form![IssueAssignBegin] &
vbNullString) = 0

vbNullString is a constant that has a value of 0 if either Is Empty or Is
Null is true. The length of the string will exceed 0 if anything at all is
in the textbox.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access
 
J

John Conklin

Arvin,

Thanks for the reply.

However, it is still changing the date to the current date even if the field
is populated with a date.

Any suggestions?

~John

Arvin Meyer said:
Instead of:

Forms![frmIssueLog]![frmStatusTimes].Form![IssueAssignBegin] = ""

Try:

Len(Forms![frmIssueLog]![frmStatusTimes].Form![IssueAssignBegin] &
vbNullString) = 0

vbNullString is a constant that has a value of 0 if either Is Empty or Is
Null is true. The length of the string will exceed 0 if anything at all is
in the textbox.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access

John Conklin said:
Hello all,

I have a form that populates dates on a subform based on the current status
value.

On opening the form I want to check the current status and the corresponding
date field, and if the date field is blank put today's date in.

How do I check for a blank date field? Here is part of my code:

If Me.Current_Status = "Issue Assignment" And
Forms![frmIssueLog]![frmStatusTimes].Form![IssueAssignBegin] = "" Then
Forms![frmIssueLog]![frmStatusTimes].Form![IssueAssignBegin] =
Date

Any and all help is greatly appreciated.

Thanks,
~John
 
J

John Conklin

Never mind, I had an error in my code and had this current status listed
twice, so it was getting changed further down in my code.

Thanks again for your help.

~John

John Conklin said:
Arvin,

Thanks for the reply.

However, it is still changing the date to the current date even if the field
is populated with a date.

Any suggestions?

~John

Arvin Meyer said:
Instead of:

Forms![frmIssueLog]![frmStatusTimes].Form![IssueAssignBegin] = ""

Try:

Len(Forms![frmIssueLog]![frmStatusTimes].Form![IssueAssignBegin] &
vbNullString) = 0

vbNullString is a constant that has a value of 0 if either Is Empty or Is
Null is true. The length of the string will exceed 0 if anything at all is
in the textbox.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access

John Conklin said:
Hello all,

I have a form that populates dates on a subform based on the current status
value.

On opening the form I want to check the current status and the corresponding
date field, and if the date field is blank put today's date in.

How do I check for a blank date field? Here is part of my code:

If Me.Current_Status = "Issue Assignment" And
Forms![frmIssueLog]![frmStatusTimes].Form![IssueAssignBegin] = "" Then
Forms![frmIssueLog]![frmStatusTimes].Form![IssueAssignBegin]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top