timevalue function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have several date/time fields in a table that I am using in a form for time
value. Behind that I have validation code in the before update event on each
field that tries to assign the time value using the timevalue function

I have tried

amIN = TimeValue(Me.MorningIn.Value)

and

if isnull(TimeValue(Me.MorningIn.Value)) then
....
else
....
endif

etc...

Howver, either way, if the field value is null, I get an error "Invalid us
of Null", but when looking at the help for timevalue it states that it will
return null if the data in the field is null. How can I write the code so
that I can put into a variable the time value of the field or know if the
field value is null?
 
Suzy,

What is amIN? If it is a variable, has it been declared as a Variant,
so that it can accept a Null?
 
Nevermind = if isnull(timevalue(...)) worked. It is in another location that
I need help. I will post message if I can't get it worked out.
 
good to know, thanks

I got around it by checking first with isnull then assigning it only if it
is null. I set another variable to now() and set amIN to that variable's
value then compared those two variables later in code to tell me if the
original was null. But knowing how access works is better to use it to its
limitations/features instead of adding my own fixes. Thanks.
 

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