T
Tirelle
I have created a report which I need to set the control source of a group
of fields on the subreport dynamically when opened. The goal is only to put
string in the fields in all fileds named week1,week2,etc. at the code level
so that if I add controls they will inherit this controlsource. Here is the
code :
Private Sub Report_Load()
Dim WkOf As Control
For Each WkOf In Me.sbrptQualifications.Controls
If Left(WkOf.Name, 4) = "Week" Then
'WkOf.ControlSource = "
=IIf([LastWeekGenerated]>=1,getweekof([startdate],[lastweekgenerated],1),"""")"
Reports!rptQualificationSequence!sbrptQualifications(WkOf.Name).ControlSource
= "
=IIf([LastWeekGenerated]>=1,getweekof([startdate],[lastweekgenerated],1),"""")"
End If
Next
End Sub
I currently have it in the main reports load event but I will put it
whereever needed to make it work. When I run it, I get a syntax error. Can
anyone help?
of fields on the subreport dynamically when opened. The goal is only to put
string in the fields in all fileds named week1,week2,etc. at the code level
so that if I add controls they will inherit this controlsource. Here is the
code :
Private Sub Report_Load()
Dim WkOf As Control
For Each WkOf In Me.sbrptQualifications.Controls
If Left(WkOf.Name, 4) = "Week" Then
'WkOf.ControlSource = "
=IIf([LastWeekGenerated]>=1,getweekof([startdate],[lastweekgenerated],1),"""")"
Reports!rptQualificationSequence!sbrptQualifications(WkOf.Name).ControlSource
= "
=IIf([LastWeekGenerated]>=1,getweekof([startdate],[lastweekgenerated],1),"""")"
End If
Next
End Sub
I currently have it in the main reports load event but I will put it
whereever needed to make it work. When I run it, I get a syntax error. Can
anyone help?