PDA

View Full Version : Solved: Date display



av8tordude
12-30-2011, 11:30 AM
I have this code that will display in a userform label...

lbGreet = " Welcome to the Download Portal. The Download" & vbNewLine & _
" Portal allows the ability to download Federal M&IE rates and other" & vbNewLine & _
" rates that will be used to calculate your tax deductions. PerDiem" & vbNewLine & _
" Traveler comes with an introductory subscription will expire:" & vbNewLine & _
" " & vbNewLine & _
" 09/30/" & Year(Date) & vbNewLine & _
"" & vbNewLine & _
" Before you get started, you must download the CONUS, OCONUS" & vbNewLine & _
" and Transporation rates. Internet connection is required."

Where it says 09/30 & Year(Date), I would like it to display 09/30 and the current year (if the current date is not passed 09/30). If the current date has already passed, I would like the date to display the following year.

i.e. Since 09/30/2011 has already passed, then show 09/30/2012. If we were in already in 2012, then show 09/30/12

Thank you for your help

mdmackillop
12-30-2011, 12:35 PM
Dim Dt2 As Long, Dt1 As Date
Dt1 = DateSerial(Year(Date), 9, 30)
Dt2 = (Date - Dt1) > 0
Dt1 = DateSerial((Year(Date) - Dt2), 9, 30)
lbgreet = " Welcome to the Download Portal. The Download" & vbNewLine & _
" Portal allows the ability to download Federal M&IE rates and other" & vbNewLine & _
" rates that will be used to calculate your tax deductions. PerDiem" & vbNewLine & _
" Traveler comes with an introductory subscription will expire:" & vbNewLine & _
" " & vbNewLine & _
" " & Dt1 & vbNewLine & _
"" & vbNewLine & _
" Before you get started, you must download the CONUS, OCONUS" & vbNewLine & _
" and Transporation rates. Internet connection is required."

av8tordude
12-30-2011, 12:54 PM
Thank you Mike. Works great:thumb

mdmackillop
12-30-2011, 01:10 PM
Thank you Mike. Works great:thumb
It's "Malcolm" and happy it works!

av8tordude
12-30-2011, 03:59 PM
My apologies Malcolm, Thank you