Dynamic report label

T

Tara

I have several reports where the user can change the underlying data source
according to a drop-down list on a form. It works perfectly, but now I need
to also change the report labels to reflect which report was generated.
Here's the code that is used to change the data source for one of the
reports. I'm not sure how to incorporate the change for the label though.

Private Sub Report_Open(Cancel As Integer)

Select Case Forms!frmReportType!cboReport
Case "Original"
Me.RecordSource = "UqryTimeSheet"
Me.OrderBy = "UqryTimeSheet.Program"


Case "Amended"
Me.RecordSource = "UqryTimeSheetAmended"
Me.OrderBy = "UqryTimeSheetAmended.Program"

Case Else
MsgBox "Please contact the database administrator for assistance"
End Select

End Sub

Thanks for any help!
 
M

Marshall Barton

Tara said:
I have several reports where the user can change the underlying data source
according to a drop-down list on a form. It works perfectly, but now I need
to also change the report labels to reflect which report was generated.
Here's the code that is used to change the data source for one of the
reports. I'm not sure how to incorporate the change for the label though.

Private Sub Report_Open(Cancel As Integer)

Select Case Forms!frmReportType!cboReport
Case "Original"
Me.RecordSource = "UqryTimeSheet"
Me.OrderBy = "UqryTimeSheet.Program"


Case "Amended"
Me.RecordSource = "UqryTimeSheetAmended"
Me.OrderBy = "UqryTimeSheetAmended.Program"

Case Else

Just add lines like:
Me.label.Caption = "something"
to each case.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top