G
Guest
hey
So... i have this continous form, based on a query.
On the form are a few fields like, [name], [birthdate]..etc.
I wanted to display next to each name the number of days
until that persons birthday So, i created a calculated field called
"DaysLeft" , and
slapped this into the control source;
=IIf(IsNull([Birthdate]),"",IIf((DateDiff("d",Format(Now(),"mmmm
dd"),Format([Birthdate],"mmmm dd")))<0,(DateDiff("d",Format(Now(),"mmmm
dd"),Format([Birthdate],"mmmm dd")))+365,DateDiff("d",Format(Now(),"mmmm
dd"),Format([Birthdate],"mmmm dd"))))
First, i wanted to check with you guys to see if its correct - it seems to
work fine, though im not sure how deadly accurate the result is with the
"365" as part of the calculation.. Is there an easier way to do it?
Secondly, i wanted to sort the continous form according to that calculated
field,"DaysLeft", and from a previous post here i gather thats impossible.
That, rather, i should create the calculated field in the underlying query
which makes up the form before i can sort using it.
And when i say sort, I guess i mean ORDERBY - there is no other command that
will sort, right?
Best regards,
WebDude
btw: 18 days left until MY birthday! wooooo. (not that im counting ) lol
So... i have this continous form, based on a query.
On the form are a few fields like, [name], [birthdate]..etc.
I wanted to display next to each name the number of days
until that persons birthday So, i created a calculated field called
"DaysLeft" , and
slapped this into the control source;
=IIf(IsNull([Birthdate]),"",IIf((DateDiff("d",Format(Now(),"mmmm
dd"),Format([Birthdate],"mmmm dd")))<0,(DateDiff("d",Format(Now(),"mmmm
dd"),Format([Birthdate],"mmmm dd")))+365,DateDiff("d",Format(Now(),"mmmm
dd"),Format([Birthdate],"mmmm dd"))))
First, i wanted to check with you guys to see if its correct - it seems to
work fine, though im not sure how deadly accurate the result is with the
"365" as part of the calculation.. Is there an easier way to do it?
Secondly, i wanted to sort the continous form according to that calculated
field,"DaysLeft", and from a previous post here i gather thats impossible.
That, rather, i should create the calculated field in the underlying query
which makes up the form before i can sort using it.
And when i say sort, I guess i mean ORDERBY - there is no other command that
will sort, right?
Best regards,
WebDude
btw: 18 days left until MY birthday! wooooo. (not that im counting ) lol