A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Report title based on Date?



 
 
Thread Tools Display Modes
  #1  
Old April 22nd, 2010, 06:33 PM posted to microsoft.public.access.reports
Jim
external usenet poster
 
Posts: 39
Default Report title based on Date?

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


  #3  
Old April 22nd, 2010, 08:33 PM posted to microsoft.public.access.reports
John Spencer
external usenet poster
 
Posts: 7,815
Default Report title based on Date?

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


  #4  
Old April 22nd, 2010, 10:50 PM posted to microsoft.public.access.reports
Jim
external usenet poster
 
Posts: 39
Default Report title based on Date?

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" wrote in message
...
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


  #5  
Old April 22nd, 2010, 11:20 PM posted to microsoft.public.access.reports
Steve[_77_]
external usenet poster
 
Posts: 1,017
Default Report title based on Date?

Jim,

Put the code on the report's open event.

Steve



"Jim" wrote in message
...
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" wrote in message
...
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




  #6  
Old April 23rd, 2010, 04:42 PM posted to microsoft.public.access.reports
Jim
external usenet poster
 
Posts: 39
Default Report title based on Date?

When I do that, it tells me I can't assign a value to this object error
number -2147352567 (800200009)

Jim

"Steve" wrote in message
...
Jim,

Put the code on the report's open event.

Steve



"Jim" wrote in message
...
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" wrote in message
...
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






  #7  
Old April 23rd, 2010, 04:45 PM posted to microsoft.public.access.reports
Jim
external usenet poster
 
Posts: 39
Default Report title based on Date?

I put it in the On Format event in the Report Header section and it's
working now.
Thanks

Jim

"Steve" wrote in message
...
Jim,

Put the code on the report's open event.

Steve



"Jim" wrote in message
...
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" wrote in message
...
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






 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:57 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.