Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / December 2005

Tip: Looking for answers? Try searching our database.

Labels in group headers question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BobbyS - 05 Dec 2005 00:35 GMT
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.
fredg - 05 Dec 2005 00:58 GMT
> 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
[quoted text clipped - 16 lines]
>
> 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.
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.