Report title expression

GingGangGoo

Registered User.
Local time
Today, 01:35
Joined
Dec 14, 2010
Messages
121
I would like to have my Report Title show the current quarter #. I thought I could set the control of field [Quarter] to an expression like this:
[Quarter]&"th","Qrt",& Format(Date(),"yyyy") so that I get this:
4th Qrt 2015

I know the expression example I've given is not right, but nothing I have tried so far has worked.

TIA
 
I use a homemade function and call it in the query, QtrTitle([EventDate])

Code:
'SET QUARTER of the year
Public Function QtrTitle(ByVal pvDate)
Dim iMo As Integer

If IsNull(pvDate) Then
   QtrTitle = ""
Else
    iMo = Month(pvDate)
    Select Case iMo
      Case 1, 2, 3
         QtrTitle = "1st Qtr"
         
      Case 4, 5, 6
         QtrTitle = "2nd Qtr"
      
      Case 7, 8, 9
         QtrTitle = "3rd Qtr"
      
      Case 10, 11, 12
         QtrTitle = "4th Qtr"
    End Select
End If
End Function
 
on Report Open event:

Private Sub Report_Open(Cancel As Integer)
Dim strQuarter As String
strQuarter = Format(Date, "q")
'\\ if it is a label control on your report
Me.Label0.Caption = strQuarter & Choose(Val(strQuarter), "st", "nd", "rd", "th") & " Qtr " & Year(Date)
End Sub

make sure to replace the blue colored text with the correct label control name on your report.

if it a textbox, set the control source to:

=Format(Date(),"q") & Choose(Val(Format(Date(),"q")),"st","nd","rd","th") & " Qtr " & Year(Date())
 
Last edited:

Users who are viewing this thread

Back
Top Bottom