By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,587 Members | 1,047 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,587 IT Pros & Developers. It's quick & easy.

Help determining Record Source for report

P: n/a
I have a form that has a table; tblProjects; as its record source. The form
is filtered, however, by two combo boxes in the header. One allows the user
to select a client, the other a project for that client. These two
selections populate the form with info from that tblProjects table. I want
to create a report that would contain the information from that form but I
have no idea what my record source should be for the report so that it
contains only the information for that one client and one project. I tried
using the same record source and filter at the form (RS = tblProjects and
Filter = ProjectID = Forms!frmWorksheet!SelectProject) but it doesnt work.
The report shows all of the records in tblProjects. Any thoughts on where
to begin?
May 21 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Robert" <no**@email.com> wrote in
news:hM********************@fe07.news.easynews.com :
I have a form that has a table; tblProjects; as its record
source. The form is filtered, however, by two combo boxes in
the header. One allows the user to select a client, the other
a project for that client. These two selections populate the
form with info from that tblProjects table. I want to create a
report that would contain the information from that form but I
have no idea what my record source should be for the report so
that it contains only the information for that one client and
one project. I tried using the same record source and filter
at the form (RS = tblProjects and Filter = ProjectID =
Forms!frmWorksheet!SelectProject) but it doesnt work. The
report shows all of the records in tblProjects. Any thoughts
on where to begin?

You use the same recordsource as the form: tblProjects.
Use the whereclause parameter of the .openreport method of DoCmd
to pass the filter conditions from the form to the report.

In the on_click event for the button that opens the report,
simply set the where clause to

stWhereClause = "ProjectID = " & me!SelectProject
stDocName = "ProjectReport"

Docmd.OpenReport stDocName,acPreview,,,stWhereClause

since you are calling the report from the form,
me. is defined as Forms!frmWorksheet

--
Bob Quintal

PA is y I've altered my email address.
May 21 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.