Date field and Null

D

Deb

I want to check if the Qty field is updated, then post
Today's date in the completed field if no date exists
already, otherwise, keep the current date value.

Here's what I have, but it doesn't add today's date.

Private Sub Qty_AfterUpdate()
If [Completed] = Null Then
Me.[Completed] = Date
Else
End If
End Sub

Any ideas?
 
J

John Vinson

I want to check if the Qty field is updated, then post
Today's date in the completed field if no date exists
already, otherwise, keep the current date value.

Here's what I have, but it doesn't add today's date.

Private Sub Qty_AfterUpdate()
If [Completed] = Null Then
Me.[Completed] = Date
Else
End If
End Sub

Any ideas?

Nothing is equal to NULL, or unequal to NULL - any comparison
operation with NULL will return neither true nor false, but NULL.

Try instead

If IsNull([Completed]) Then Me.Completed = Date

(You don't need the ELSE line if you aren't doing anything Else.)
 

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