>
>Why do you need UDF here at all? Or this is just a test code? You still should pass date1 and date2 to the function as parameters.
>
>BTW, I didn't read the whole thread yet. So I can see now that Sergey surely already answered.
It was just a test code. And Sergey's suggestion/solution works.
"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