Link to home
Start Free TrialLog in
Avatar of MICHAED
MICHAED

asked on

"Invalid Use Of Null" using CDate

Hi All,

I have a date/time field in a table which is converted within a query from a string value via the following:

New Date Field: Int(CDate([Original Date Field]))

The problem is, I cannot view the query in design view if any records do not have data within the date field -- I get a "Invalid Use Of Null" error message.  This field will not always contain data, therefore, I need some way to work around this.

Suggestions?

Thanks,
Ed
SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MICHAED
MICHAED

ASKER

Hi,

I'm getting "Invalid Operator" so I'm trying to find the expression's error....
Alternatively, you can avoid the IIF function by using:
     Format(Nz([Original Date Field], ""), "mm/dd/yy")
Avatar of MICHAED

ASKER

Jokra, will your function convert my date/time field ...or leave it as a string?
Avatar of MICHAED

ASKER

Folks, I've tried all suggestions -- and I do not get the error anymore.  However, the sort order is incorrect...it appears that the field is sorting like a string field rather than a date field.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MICHAED

ASKER

Shane's version worked -- thanks all!

Ed