>>>>Hi,
>>>>
>>>>When using SQL Server and allowing NULL in empty dates I came across a small issue where EMPTY( date_field) returns .F. when the entry in date_field is NULL. And this of course breaks a lot of code where the program relied on the date field being empty. I am thinking of creating a simple function like this:
>>>>
>>>>Function MyEmpty
>>>>lparameter tDate
>>>>if empty( tDate) or isnull( tDate)
>>>> return .T.
>>>>else
>>>> return .F.
>>>>endif
>>>>
>>>>
>>>>And replace everywhere in the program where I use
>>>>
>>>>if EMPTY( date_field )
>>>>
>>>>with
>>>>
>>>>if MyEmpty( date_field )
>>>>
>>>>
>>>>Can anybody see a potential problem with the above approach? TIA.
>>>
>>>IF EMPTY(nvl(datefield,{})).....
>
>>
>>I think your approach is probably better. Except a little more characters to type when making changes <g>. Thank you.
>
>You can always pass the var to a function and check it there - you could set it to an empty date if it's null or check it for a valid date within a range if it's not null, etc....
>
Good suggestion. I can add more "features" to the function that checks for empty or null date. Thank you
>
>You're welcome ;o)
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham