View Single Post
  #2  
Old April 22nd, 2010, 06:45 PM posted to microsoft.public.access.reports
Steve[_77_]
external usenet poster
 
Posts: 1,017
Default Report title based on Date?

Hi Jim,

How about this ......

If Month(Forms!frmCommission!cboEndDate) =
Month(Forms!frmCommission!cboStartDate) then
Me.txtTitle = "Commission" & " " &
Format(Forms!frmCommission!cboStartDate, "mmmm/yyyy")
Else
Me.txtTitle = "Commission" & " " & Forms!frmCommission!cboStartDate & "
" & _
"To" & " " & Forms!frmCommission!cboEndDate
End If


Steve



"Jim" wrote in message
...
I have a report header that fills in the title based on the dates chosen on
a form with this line of code:



Me.txtTitle = "Commission" & " " &
Format(Forms!frmCommission!cboStartDate, "mmmm/yyyy")



It works well, but now I need to look at both cboStartDate and cboEndDate
and if both dates are in the same month, then display that month. ie:
Jan/2010. Or if it's a range of dates like 1/1/10 to 4/1/10, then have it
display Jan 1, 2010 to April 1, 10.



I can display multiple dates with this code:



Me.txtTitle = "Commission" & " " & Forms!frmCommission!cboStartDate & " "
& "To" & " " & Forms!frmCommission!cboEndDate



but I don't know how to tell it to pick the correct code based on the
start and End date.

Thanks for any help.



Jim