How to dynamic set the label’s caption in a report?

qwang1115

Registered User.
Local time
Yesterday, 19:32
Joined
Oct 24, 2008
Messages
14
I need to set the label’s caption based on the data in a table. But I couldn’t find the label’s caption property in “Private Sub Report_Open(Cancel As Integer)” event or other events of the report. Any hint or suggestion?

Thanks!

Lucy
 
Howzit

Although I can't find it in the properties either, it still works - my example below adds the string strLabel to the exisitng caption

Code:
Private Sub Report_Open(Cancel As Integer)

Dim strLabel As String

Select Case Forms![frmSaleReport]![fraSales]

    Case Is = 1
        'Me.Label22 = "Active Sales Execs"
        strLabel = "Status : Active"
    Case Is = 2
        strLabel = "Status : Inactive"
    Case Is = 3
        strLabel = "Status : ALL"
    
End Select


Me.Label22.Caption = Me.Label22.Caption & " - " & strLabel

End Sub
 
Thanks! Bob

I guess I did not explain my question clearly.
My question is: I need to generate a report based on table1, but instead of the labels are B1, B2 and B3, I would like to use the BankName from table2. Thank you so much for the help!

Table1
ClientID B1 B2 B3
1 $10 $20 $30
2 $100 $200 $300
3 $1 $2 $3
Table2
BankID BankName
1 BOA
2 PNC
3 CitiBank

Report
ClientID BOA PNC CitiBank
1 $10 $20 $30
2 $100 $200 $300
3 $1 $2 $3

 
You would just include that in the report's query and then you can bind the text box to it.
 

Users who are viewing this thread

Back
Top Bottom