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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Labels in group headers question
I have a report in which there is a bound control (ID) in the group header. I
have put a label in the same section and want it to display text based on the number in the ID control. I have tried the following and it won't work. I am not sure at what point in the report loading I would place it either (if you are able to do this in reports). Private Sub Report_Activate() srtNum = Me.ID If strNum = 3 Then lblBudgetText.Caption = " This is label 3" End If If strNum = 4 Then lblBudgetText.Caption = "This is label 4" End If End Sub Any help would be appreciated. |
#2
|
|||
|
|||
Labels in group headers question
On Sun, 4 Dec 2005 16:35:02 -0800, BobbyS wrote:
I have a report in which there is a bound control (ID) in the group header. I have put a label in the same section and want it to display text based on the number in the ID control. I have tried the following and it won't work. I am not sure at what point in the report loading I would place it either (if you are able to do this in reports). Private Sub Report_Activate() srtNum = Me.ID If strNum = 3 Then lblBudgetText.Caption = " This is label 3" End If If strNum = 4 Then lblBudgetText.Caption = "This is label 4" End If End Sub Any help would be appreciated. There are a couple of problems with your approach. 1) The Report Activate event only fires when the report is previewed, not when it's printed. 2) The Activate event would only read the value of the very first record and not any additional ones. 3) Place your code in the Format event of the Group Header. Me![lblBudgetText].Caption = " This is label " & Me![ID] No need to create a variable to read the ID value as long as that same value is to be used in the caption. The Label caption will change as the ID changes. 4) An easier solution would be to change the label to an unbound text control. As it's control source, write: ="This is Label " & Me![ID] No VBA code is required. -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Option Group Label Issue | Jay | Using Forms | 8 | November 8th, 2005 01:51 PM |
Survey Results | SAm | Running & Setting Up Queries | 10 | May 17th, 2005 08:32 PM |
ambiguous outer joins | renwick | Running & Setting Up Queries | 3 | February 22nd, 2005 01:29 PM |
Mail Merge Problem | MT DOJ Help Desk | General Discussion | 9 | July 20th, 2004 04:55 AM |
Help Needed for Groups Please | Paul Black | General Discussion | 15 | June 21st, 2004 02:54 AM |