M
Maury Markowitz
I'm sure there's a simple trick to this, but I can't figure it out...
I'm trying to set up a report's recordsource in response to changes on an
associated form. The current implementation has the report's Open event call
into a method on the form, which creates a SQL string and hands it back.
However this is very inflexible, because it means the report is tied to
_that_ form, and I'd rather have it able to be opened from any form, or even
other applications. I would like to re-write the code to have an open method
that is handed the filters, creates the SQL, and then opens the form. Like
this...
Public Sub OpenBlotter(Optional portfolioId As Long)
theWhere = " WHERE deleted=0 "
if Nz(portfolioId) <> 0 then theWhere = theWhere & " AND portfolioId=" &
portfolioId
DoCmd.OpenReport "rptBlotter", acViewPreview
DoCmd.Maximize
Reports("rptBlotter").RecordSource = "SELECT * FROM vReportBlotter " &
theWhere
end if
I don't get any errors, but I also don't get any records. Is there some sort
of refresh command I need to use?
Maury
I'm trying to set up a report's recordsource in response to changes on an
associated form. The current implementation has the report's Open event call
into a method on the form, which creates a SQL string and hands it back.
However this is very inflexible, because it means the report is tied to
_that_ form, and I'd rather have it able to be opened from any form, or even
other applications. I would like to re-write the code to have an open method
that is handed the filters, creates the SQL, and then opens the form. Like
this...
Public Sub OpenBlotter(Optional portfolioId As Long)
theWhere = " WHERE deleted=0 "
if Nz(portfolioId) <> 0 then theWhere = theWhere & " AND portfolioId=" &
portfolioId
DoCmd.OpenReport "rptBlotter", acViewPreview
DoCmd.Maximize
Reports("rptBlotter").RecordSource = "SELECT * FROM vReportBlotter " &
theWhere
end if
I don't get any errors, but I also don't get any records. Is there some sort
of refresh command I need to use?
Maury