Lauren,
I have a fairly large ADP. In my experience you cannot change the report
recordsource or parameters in the code of the report. There are two ways to
accomplish a changing recordsource for a report.
1) Before running the report, your application can open it in design mode
(which can be hidden) and change the necessary setting, save it, close it
and reopen it. There are several negatives to this methodology. First,
your app MUST be and adp (not ade) and your users must have full Access
installed (Not runtime), as you are actually doing design changes, albiet
through code.
2) My preferred method is to base a report off of a stored procedure and
have the input parameters refer to a "Control" form that stores all of the
necessary info that the stored procedure needs to return a recordset to the
report. If you have very different data, you will most likely want to open
a different report based on an option on the "Control" form.
Using method two, you would set your report recordsouce in the properties
window to "dbo.SomeStoredProcedure". Then in the inputParameters you would
put something like:
@Param1 INT = Forms("ControlForm")("txtBoxWithInfo1"), @Param2 VARCHAR(20)
= Forms("ControlForm")("txtBoxWithInfo2")
HTH,
Jim
"lauren quantrell" <la*************@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
When I open an Access form I can have no recordset specified, then in
the form's OnOpen event I can do something like:
Me.paramaters = "@SomeColumn = 22)"
Me.recordsource = "dbo.sproc123"
But I can't do this in a report as it will prompt me for the
parameters, even though they seem to be defined ahead of the
recordsource.
I have worked around this by opening reports to a bogus recordsource
that has the same underlying parameters and tables but is designed to
return only one record, then in the report's OnOpen event I specify the
recordsource I want.This seems like a waste of speed and bandwidth.
The reason I am doing this is because I have some forms with multiple
recordsources that share the same report and in the OnOpen of the
report I user something like:
me.recordsource = Forms!myForm.RecordSource
Am I missing something here?
Thanks,
lq
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----