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!

What is default value of DateVar field?

Status
Not open for further replies.

dean12

MIS
Oct 23, 2001
273
US
I've got:

shared DateVar abc;

This is being processed by a VB routine (a UFL) and CR8.5 will give me a "Memory Full" error if I try to call the VB routine and there is not a legal date value in the variable "abc".

What I can't figure out is how to test "abc" and if it is not legal, assign a legal value like say today's date. Things like:

if IsDate(abc)

don't work because you can't pass a variable to IsDate. I tried

if abc = Date(0,0,0)

and while that compiles, it doesn't help.

Any ideas?
 
I didn't try an actual date in the Date() function - guess I should have.

Couldn't figure out how to check NULL as IsNull can't be used against a shared variable near as I can tell.

Finally, I used CStr to convert to a string and passed a string into the UFL. Happily I wrote the UFL so I could change it's logic to meet the need.
 
You can try

If Year(abc) = 0 Then
abc=CurrentDate

I am not sure why If abc = Date(0,0,0) is not working for you. I have used and it worked.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top