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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Alternatively, you can avoid the IIF function by using:
Format(Nz([Original Date Field], ""), "mm/dd/yy")
Format(Nz([Original Date Field], ""), "mm/dd/yy")
ASKER
Jokra, will your function convert my date/time field ...or leave it as a string?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Shane's version worked -- thanks all!
Ed
Ed
ASKER
I'm getting "Invalid Operator" so I'm trying to find the expression's error....