Quote:
quote:Originally posted by Fehrer
oh...almost forgot...what do u think about my second problem, in which to populate the listbox with certain reports, instead of all Reports object.
|
Hmmm... well, I'd approach that one of two ways.
[u]Related Naming</u>
Name the forms frmAAA, frmBBB, etc. and then the related reports rptAAA_AAA, rptAAA_BBB, rptBBB_AAA, etc. (change the AAA and BBB, etc. with their real names). Then in your loop you can say something like:
Code:
If Left(objAO.Name,6) = Left(Me.Name,6) Then
Me.lstReports.AddItem (objAO.Name)
End If
In this way, the loop matches up all the frmAAA with rptAAA and populates the list box.
[u]Create a relational table</u>
If you don't want to name reports similar to their related forms, then create a table with two fields. The first field has the name of the form (strFormName), the second field has the name if its related report (strReportName). Then you can use a select query to populate the list box, for example.
Code:
Me.lstReports.Rowsource = _
"Select [strReportName] From tblMyTable Where [strFormName] = '" & _
Me.Name & "'"
Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division