I have a report that when opened, it opens a form named Months that has a dropdown of all of the months of the year, when the user selects a month and clicks Get Report, the report is loaded and the record source is set to a stored procedure (yes, it is an ADP) with the month as a parameter.
Here is my code,
When I try to label the report as "Physicals Due - [MonthSelected]", it doesn't work, but if I try to label the report with the month only, it works.
What can I do to fix this?
Thanks,
Drew
Here is my code,
Code:
DoCmd.Maximize
Dim varMonth As String
Dim varMonthInt As Integer
DoCmd.OpenForm "Month", acNormal, , , , acDialog
varMonth = Forms!Month.Month
Select Case varMonth
Case "January"
varMonthInt = 1
Case "February"
varMonthInt = 2
Case "March"
varMonthInt = 3
Case "April"
varMonthInt = 4
Case "May"
varMonthInt = 5
Case "June"
varMonthInt = 6
Case "July"
varMonthInt = 7
Case "August"
varMonthInt = 8
Case "September"
varMonthInt = 9
Case "October"
varMonthInt = 10
Case "November"
varMonthInt = 11
Case "December"
varMonthInt = 12
Case Else
varMonthInt = "ERROR!"
End Select
Dim strRecordSource As String
strRecordSource = "Exec [spPhysicalsByMonth] " & varMonthInt
Me.RecordSource = strRecordSource
Me.lblTitle.Caption = "Physicals Due - " & varMonth
'Me.lblTitle.Caption = varMonth
Forms!Month.Visible = False
When I try to label the report as "Physicals Due - [MonthSelected]", it doesn't work, but if I try to label the report with the month only, it works.
What can I do to fix this?
Thanks,
Drew