Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Null value in recordset causing err when passed into date variable 1

Status
Not open for further replies.

Frank72

Technical User
Nov 13, 2001
57
IE
Hows it going

I'm trying to pass a value from a table (dateBirth) into a variable in code. on the table the field is type Date/Time and also in the code the variable is set to type date.


Rst1![DateBirth] = DateBirth
is returning "invalid use of null" and is saying that i am trying to obtain the value of a variant or expression although i have declared both as date/time.

any ideas as to what the problem might be??

many thanks

frank
 
Frank-
Date/Time variables ARE variants. My guess is that you have a null value for DateBirth in one of the records in your data. Try this-

Rst1![DateBirth] = IIF(isnull(DateBirth),0,DateBirth)

Here if DateBirth Is NULL then I'm returning 0 (zero) if not, I'm returning DateBirth.

Scott
 
NZ() will do the same for you
Rst1![DateBirth] = nz(me!birthdate)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top