initially I had a continuous report with multiple text controls at each record
at individual instances of the report, the visibility of those controls as well as the specific content them is effected by the values of an unrelated table of parameters (tblReportParms) (it only has one record) and the visibility/content of the controls is determined during the DetailFormat event of the report.
Rather than DLookUp the values of tblReportParms at each record (at each DetailFormat event for that record), I read those values into a collection at the ReportLoad event, and then refer to them as necessary (as a variable ?).
to set up the collection:
Code:
Dim dbs As Database
Dim rst As DAO.Recordset
Dim vField As DAO.Field
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tbeReportParms")
For Each vField In rst1.Fields
ReportParms.Add vField.Value, "v" & vField.Name
Next vField
in the DetailFormat event of the report, to use those values
(like this...):
Code:
If ReportParms!vShortDescription = "false" Then
strDescription = strDescription & strBaseDescription
Else
If InStr(1, strBaseDescription, ". ") > 0 Then
strDescription = strDescription & Mid(strBaseDescription, 1, InStr(1, strBaseDescription, ". "))
Else
strDescription = strDescription & strBaseDescription
End If
End If
_____________
the report has been reformatted to combine the text controls onto multiple subReports -but the "effected" visibility and content of the control is still relevant. All of the subReports still need to make reference to the values of tblReportParms. Perplexingly, creating the collection at the main Report doesn't work as the subReports are opened first (and the necessary values will not yet been created...)
AND HERE'S WHERE I AM LOST...
Behind the command control that will trigger the report to open (but in front of the code line that actually opens the report), I thought that I could create a collection (?) as I had previously done (with the values of tblReportParms), store the values as public(?) variables and then reference them in the same way... THIS is where I am making a mess of things, running in circles, and into dead ends.
currently, I have (going back to where I started after many iterations):
at the top of the module that contains code for the report open event:
Code:
Public dbs As Database
Public rst As DAO.Recordset
Public vField As DAO.Field
at the ReportOpen event (in the report's module):
Code:
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tbeReportParms")
For Each vField In rst1.Fields
ReportParms.Add vField.Value, "v" & vField.Name
Next vField
[/CODE]
and then in the DetailFormat event of the main Report AND each of the subReports...
(like this...):
Code:
If ReportParms!vShortDescription = "false" Then
strDescription = strDescription & strBaseDescription
Else
If InStr(1, strBaseDescription, ". ") > 0 Then
strDescription = strDescription & Mid(strBaseDescription, 1, InStr(1, strBaseDescription, ". "))
Else
strDescription = strDescription & strBaseDescription
End If
End If
but it is obviously deficient !
ANY thoughts, direction, or kind words will be greatly appreciated in advance,
mark