Form or Report?

G

Guest

I need to build an app to view and print (not modify or add to) voter data.

One section would accept several optional inputs, such as Party, Precinct,
City, etc. These "dropdown boxes" should be populated with a unique list from
the database. The result would be a printable list of name, address, party,
precinct.

Another section would use similar input but provide more detail on
individual voters.

I am confused on whether to use forms or reports, and how to link to
multiple queries. Thanks!
 
J

John W. Vinson

I need to build an app to view and print (not modify or add to) voter data.

One section would accept several optional inputs, such as Party, Precinct,
City, etc. These "dropdown boxes" should be populated with a unique list from
the database. The result would be a printable list of name, address, party,
precinct.

Another section would use similar input but provide more detail on
individual voters.

I am confused on whether to use forms or reports, and how to link to
multiple queries. Thanks!

Use an unbound Form, frmCriteria let's say, with combo boxes to select the
party, precinct, city and so on; use a Query with parameters

=[Forms]![frmCriteria]![cboParty]

where cboParty is the name of the Party combo box, as a criterion on Party;
and use a Report based on this query. Put a command button on frmCriteria to
print the report.

John W. Vinson [MVP]
 
G

Guest

Thanks John. A bit more clarification please.

I now have a form frmWalkList with two unbound combo boxes: cboParty and
cboPrecinct. Each is populated with a query; i.e. qryParty = "SELECT
qryParty.Party FROM qryParty ORDER BY [Party]; "

When I "run" this form I can choose a single distinct value from each of
those columns in the base table. Now I *believe* I need to insert these
values into another query to deliver results to the report. And the command
button to trigger this operation?

Thanks again!


John W. Vinson said:
I need to build an app to view and print (not modify or add to) voter data.

One section would accept several optional inputs, such as Party, Precinct,
City, etc. These "dropdown boxes" should be populated with a unique list from
the database. The result would be a printable list of name, address, party,
precinct.

Another section would use similar input but provide more detail on
individual voters.

I am confused on whether to use forms or reports, and how to link to
multiple queries. Thanks!

Use an unbound Form, frmCriteria let's say, with combo boxes to select the
party, precinct, city and so on; use a Query with parameters

=[Forms]![frmCriteria]![cboParty]

where cboParty is the name of the Party combo box, as a criterion on Party;
and use a Report based on this query. Put a command button on frmCriteria to
print the report.

John W. Vinson [MVP]
 
J

John W. Vinson

Thanks John. A bit more clarification please.

I now have a form frmWalkList with two unbound combo boxes: cboParty and
cboPrecinct. Each is populated with a query; i.e. qryParty = "SELECT
qryParty.Party FROM qryParty ORDER BY [Party]; "

When I "run" this form I can choose a single distinct value from each of
those columns in the base table. Now I *believe* I need to insert these
values into another query to deliver results to the report. And the command
button to trigger this operation?

Thanks again!

No. You do NOT need to store these values anywhere.

I don't know what qryParty is - but I'd be inclined to base your combo box on
a query directly referencing the Party table, rather than basing a query on
another query. What's the reason for the extra step? The combo's Row Source
could simply be

SELECT Party FROM [the name of the party table] ORDER BY Party;

Your Query would have a criterion on the Party field of

=[Forms]![frmWalkList]![cboParty]

and similarly for the other fields. You would simply base the Report *on this
query* as its Recordsource. You don't need to "open" the query or "deliver"
the results; the report will "run" the query when you open it. So just put a
command button on frmWalkList, using the toolbar wizard, to open the Report.

John W. Vinson [MVP]
 
G

Guest

Hi John - Bear with me please, I still don't get it.

I have my frmWalkList with two combo boxes, cboParty & cboPrecinct. Each now
has it's own direct query for it's Row Source: i.e. SELECT DISTINCT
VoterFile.Party FROM VoterFile; This populates the dropdown list in each
combo box.

I have a command button on the form. I have a report called rptWalkList.
How/where do the results from the two combo boxes get plugged into a query &
passed to the report?

Thanks agan!


John W. Vinson said:
Thanks John. A bit more clarification please.

I now have a form frmWalkList with two unbound combo boxes: cboParty and
cboPrecinct. Each is populated with a query; i.e. qryParty = "SELECT
qryParty.Party FROM qryParty ORDER BY [Party]; "

When I "run" this form I can choose a single distinct value from each of
those columns in the base table. Now I *believe* I need to insert these
values into another query to deliver results to the report. And the command
button to trigger this operation?

Thanks again!

No. You do NOT need to store these values anywhere.

I don't know what qryParty is - but I'd be inclined to base your combo box on
a query directly referencing the Party table, rather than basing a query on
another query. What's the reason for the extra step? The combo's Row Source
could simply be

SELECT Party FROM [the name of the party table] ORDER BY Party;

Your Query would have a criterion on the Party field of

=[Forms]![frmWalkList]![cboParty]

and similarly for the other fields. You would simply base the Report *on this
query* as its Recordsource. You don't need to "open" the query or "deliver"
the results; the report will "run" the query when you open it. So just put a
command button on frmWalkList, using the toolbar wizard, to open the Report.

John W. Vinson [MVP]
 
J

John W. Vinson

Hi John - Bear with me please, I still don't get it.

I have my frmWalkList with two combo boxes, cboParty & cboPrecinct. Each now
has it's own direct query for it's Row Source: i.e. SELECT DISTINCT
VoterFile.Party FROM VoterFile; This populates the dropdown list in each
combo box.

I have a command button on the form. I have a report called rptWalkList.
How/where do the results from the two combo boxes get plugged into a query &
passed to the report?

rptWalkList has (or should have) a Recordsource property, a query which
returns the data that you want to see on the report.

That query should have two criteria: on Party the criterion should be

=[Forms]![frmWalkList]![cboParty]

and on Precinct

=[Forms]![frmWalkList]![cboPrecinct]

Alter the query to include these criteria, and that should be ALL that you
need to do. The command button should simply open rptWalkList.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top