From: deb on
main report is rClosureContrReq
subreport is rClosureFuel (key is ProjectID) uses query qClosureFuel

If the Unit is 0 on the main report then show all Fuel for the ProjectID
else show only the Fuel where unit matches Unit on the Main report

The typo in the origional post should be t000Facts.
Will onOpen will work if I an using a MDE?

Thanks all!!
--
deb


"Duane Hookom" wrote:

> Is there something you should be telling us about the two different reports?
> Are they main and subreport?
>
> I think having properties in one report depend on properties in another
> report is a bad idea unless they are main and subreport.
>
> --
> Duane Hookom
> Microsoft Access MVP
>
>
> "deb" wrote:
>
> > Access 2003
> > I am trying to change the record source of my report using the below code.
> > I get error 2191. What is the correct way to set the record source of a
> > report?
> >
> > If UnitNo = 0 Then
> > Dim strsql3 As String
> > Dim strsql4 As String
> > strsql3 = "SELECT t040Project.ProjectID,
> > t041ProjectDetails.ProjectDetailsID, " & _
> > " FROM t040Project INNER JOIN (t041ProjectDetails INNER JOIN t000Facts
> > " & _
> > " ON t041ProjectDetails.UnitID = t000Facts.UnitID) " & _
> > " ON t040Project.ProjectID = t041ProjectDetails.ProjectID " & _
> > " WHERE (((t040Project.ProjectID)=[Reports]![rClosure]![ProjectID])) " & _
> > " ORDER BY t000GFacts.Unit;"
> > Me.rClosureFuel.Report.RecordSource = strsql3
> > Me.rClosureFuel.Report.Requery
> > --
> > deb
From: Duane Hookom on
You won't be able to change the record source of a subreport if it renders
more than once. I would use two copies of the same subreport and set the
visible properties based on the Unit being 0 or not.
--
Duane Hookom
Microsoft Access MVP


"deb" wrote:

> main report is rClosureContrReq
> subreport is rClosureFuel (key is ProjectID) uses query qClosureFuel
>
> If the Unit is 0 on the main report then show all Fuel for the ProjectID
> else show only the Fuel where unit matches Unit on the Main report
>
> The typo in the origional post should be t000Facts.
> Will onOpen will work if I an using a MDE?
>
> Thanks all!!
> --
> deb
>
>
> "Duane Hookom" wrote:
>
> > Is there something you should be telling us about the two different reports?
> > Are they main and subreport?
> >
> > I think having properties in one report depend on properties in another
> > report is a bad idea unless they are main and subreport.
> >
> > --
> > Duane Hookom
> > Microsoft Access MVP
> >
> >
> > "deb" wrote:
> >
> > > Access 2003
> > > I am trying to change the record source of my report using the below code.
> > > I get error 2191. What is the correct way to set the record source of a
> > > report?
> > >
> > > If UnitNo = 0 Then
> > > Dim strsql3 As String
> > > Dim strsql4 As String
> > > strsql3 = "SELECT t040Project.ProjectID,
> > > t041ProjectDetails.ProjectDetailsID, " & _
> > > " FROM t040Project INNER JOIN (t041ProjectDetails INNER JOIN t000Facts
> > > " & _
> > > " ON t041ProjectDetails.UnitID = t000Facts.UnitID) " & _
> > > " ON t040Project.ProjectID = t041ProjectDetails.ProjectID " & _
> > > " WHERE (((t040Project.ProjectID)=[Reports]![rClosure]![ProjectID])) " & _
> > > " ORDER BY t000GFacts.Unit;"
> > > Me.rClosureFuel.Report.RecordSource = strsql3
> > > Me.rClosureFuel.Report.Requery
> > > --
> > > deb