Date and IIF
Maybe...
Dim A as date
Dim B as date
'how does A get populated???
'test data
a = dateserial(2008,1,2) + timeserial(12,30,45)
if day(a) < 11 then
b = dateserial(year(a), month(a), 1)
else
b = dateserial(year(a), month(a) + 1, 1)
end if
or as one line:
B = DateSerial(Year(A), Month(A) - CBool(Day(A) 10), 1)
What's N?
scubadiver wrote:
I have a date called A in 'date/time' format and I need a new date called B
based on A.
If the day of month is less than the 11th then N needs to be the 1st of the
month in A. If the day of month is 11th or later then it needs to be the 1st
of the next month.
At the moment I have the following and it is text format:
Month1: IIf(Format([detdate],"dd")<=10,"1/" & Format([detdate],"mm/yy"),"1/"
& (Format([detdate],"mm")+1) & "/" & (Format([detdate],"yy")))
I need it in 'date/time' format.
thanks!
--
Dave Peterson
|