From: Jim on
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


From: Steve on
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
santus(a)penn.com


"Jim" <jim(a)gordonferon.com> wrote in message
news:OHrdgHk4KHA.420(a)TK2MSFTNGP02.phx.gbl...
>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
>
>


From: John Spencer on
IF Format(Forms!frmCommission!cboStartDate,"mmyyyy") =
Format(Forms!frmCommission!cboEndDate,"mmyyyy" THEN

Me.txtTitle = "Commission " & _
Format(Forms!frmCommission!cboStartDate,"mmm/yyyy")
ELSE
Me.txtTitle = "Commission " & _
Forms!frmCommission!cboStartDate & " To " & _
Forms!frmCommission!cboEndDate
END IF

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

Jim wrote:
> 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
>
>
From: Jim on
Thanks, both codes work. However, I have to close the report and reopen it
twice before the title displays. Is there something else I need to do?

Jim

"John Spencer" <spencer(a)chpdm.edu> wrote in message
news:e4lgfKl4KHA.4520(a)TK2MSFTNGP02.phx.gbl...
> IF Format(Forms!frmCommission!cboStartDate,"mmyyyy") =
> Format(Forms!frmCommission!cboEndDate,"mmyyyy" THEN
>
> Me.txtTitle = "Commission " & _
> Format(Forms!frmCommission!cboStartDate,"mmm/yyyy")
> ELSE
> Me.txtTitle = "Commission " & _
> Forms!frmCommission!cboStartDate & " To " & _
> Forms!frmCommission!cboEndDate
> END IF
>
> John Spencer
> Access MVP 2002-2005, 2007-2010
> The Hilltop Institute
> University of Maryland Baltimore County
>
> Jim wrote:
>> 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
>>

From: Steve on
Jim,

Put the code on the report's open event.

Steve
santus(a)penn.com


"Jim" <jim(a)gordonferon.com> wrote in message
news:OprwiXm4KHA.5548(a)TK2MSFTNGP04.phx.gbl...
> Thanks, both codes work. However, I have to close the report and reopen it
> twice before the title displays. Is there something else I need to do?
>
> Jim
>
> "John Spencer" <spencer(a)chpdm.edu> wrote in message
> news:e4lgfKl4KHA.4520(a)TK2MSFTNGP02.phx.gbl...
>> IF Format(Forms!frmCommission!cboStartDate,"mmyyyy") =
>> Format(Forms!frmCommission!cboEndDate,"mmyyyy" THEN
>>
>> Me.txtTitle = "Commission " & _
>> Format(Forms!frmCommission!cboStartDate,"mmm/yyyy")
>> ELSE
>> Me.txtTitle = "Commission " & _
>> Forms!frmCommission!cboStartDate & " To " & _
>> Forms!frmCommission!cboEndDate
>> END IF
>>
>> John Spencer
>> Access MVP 2002-2005, 2007-2010
>> The Hilltop Institute
>> University of Maryland Baltimore County
>>
>> Jim wrote:
>>> 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
>>>
>