If anyone is interested i got a great response in a different group. It will be great if this topic is ever searched again:
"Dirk Goldgar" <dg@NOdataSPAMgnostics.com> wrote in message news:<#HeQRbtJBHA.1128@tkmsftngp02>...
> The Reports collection only holds open reports, so if your report is not yet
> open it won't be in there. What you need to set up is a way for the report
> itself to determine, in its Open event, which query to use as its
> recordsource. Unfortunately, the OpenReport method doesn't let you pass an
> argument to the report (the way OpenForm does for forms), but I can think of
> two simple ways to do this.
>
> (1) If the report is always opened from this form, then the report can look
> at the form to see what the states of the combo boxes are. You'd have code
> like this in the report's Open event:
>
> '---- Warning: air code ----
> Private Sub Report_Open(Cancel As Integer)
>
> Dim frm As Form
>
> On Error Resume Next
> Set frm = Forms!ReportParameters
> If Err.Number = 0 Then
> With frm
> If !cbox_Status = "(ALL)" And !cbox_Trait = "(ALL)" Then
> Me.RecordSource = "qryReport_Chars_none"
> ElseIf !cbox_Status <> "(ALL)" And !cbox_Trait = "(ALL)"
> Then
> Me.RecordSource = "qryReport_Chars_statusonly"
> ElseIf cbox_Status = "(ALL)" And cbox_Trait <> "(ALL)" Then
> Me.RecordSource = "qryReport_Chars_traitonly"
> Else
> Me.RecordSource = "qryReport_Chars"
> End If
> End With
> Set frm = Nothing
> End If
>
> End Sub
> '---- end of code ----
>
> (2) You could alternatively define a global variable -- a Public variable in
> a standard module -- that you will use to communicate with the report.
> Before opening the report, you set this variable to either the name of the
> desired recordsource query, or to a value that the report can use in its
> open event to decide what the recordsource should be. So, for example, you
> could have code like this:
>
> '---- in a standard module somewhere ----
> Public gstrReport_rptChar_Recordsource
>
> '---- in the form's module ----
> If Me!cbox_Status = "(ALL)" And Me!cbox_Trait = "(ALL)" Then
> gstrReport_rptChar_Recordsource = "qryReport_Chars_none"
> ElseIf !cbox_Status <> "(ALL)" And !cbox_Trait = "(ALL)" Then
> gstrReport_rptChar_Recordsource = "qryReport_Chars_statusonly"
> ElseIf cbox_Status = "(ALL)" And cbox_Trait <> "(ALL)" Then
> gstrReport_rptChar_Recordsource = "qryReport_Chars_traitonly"
> Else
> gstrReport_rptChar_Recordsource = "qryReport_Chars"
> End If
> DoCmd.OpenReport "rptChar", A_PREVIEW
>
> '---- in the report's Open event ----
> Private Sub Report_Open(Cancel As Integer)
>
> If Len(gstrReport_rptChar_Recordsource) > 0 Then
> Me.RecordSource = gstrReport_rptChar_Recordsource
> End If
>
> gstrReport_rptChar_Recordsource = ""
>
> End Sub
>
> '---- end of code ----
>
> I hope this gives you some ideas.
>
> --
> Dirk Goldgar
>
www.datagnostics.com