time field

  • Thread starter Thread starter brino
  • Start date Start date
B

brino

hi all !
i have a time field in a form and its in 24 hour time.
i need to be able to bring up a message when the user does not enter
anything in this field.
i tried some code to test if the field is null but it didnt work for
some reason.
i entered the code in the "on exit" section of the "events" in the
properties of the form.
the code is below :

if me.Time = null then
docmd.open form "time warning"
end if


i know im doing something wrong ... just dont know what it is ??
thanks
brino
 
You can't use an equal sign to test for Null. That's because Null is a
special case: it means "unknown", so that Null is not equal to Null. You
need to use the IsNull function:

if IsNull(Me.[Time] Then
DoCmd.OpenForm "time warning"
End If

BTW, Time is a bad choice for the name of a field or control. It's a
reserved word in Access, and using it for your own purposes can lead to
problems. If you cannot (or will not) change its name, at least put square
brackets around it, as I've done above.
 

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

Back
Top