Way to make a report and print with only selected records

G

Guest

Ok, i'm not sure where this would go, in reports, forms, or queries. If this
is in the wrong place, could a mod/admin move it to the correct place?

moving on.

I have records that are generated from a C++ program i wrote. (the records
track a QA test and save to the db) I want to print a nice formatted report
with the records, which i already can do, but it prints all the records.

what i want is a way for someone to go to the database and select a number
of criteris (customer, Purchase Order, Part Number, Tester, date, etc.) and
then print only those records that meet that criteria. I know you can build
a report off of a query, and the report will have only the information in the
query. I was thinking that a form could have the info like, select a part
number, or you could type in the date or tester, and then it would update the
query. then, on the form, there would be a print button that would print the
report using the info from the query.

does that make any sense? can anyone help me?

Thank you.
 
L

Larry Linson

I presume you are initiating the Report from code behind a CommandButton's
Click event. If so, then you build the WhereCondition argument of the
DoCmd.OpenReport in code, using values selected on a Form by the user.

Alternatively, and possibly (but not necessarily), more efficient, you could
create the WHERE clause, append it to the base Query, and set that into the
Report's RecordSource in the Open event of the Report.

Larry Linson
Microsoft Access MVP
 
G

Guest

Wow, that's a lot. I'm new at Access, so I'm not too familiar with the
Where conditioning and clauses and such. I have some simple expierence with
entering data, and making single table fields, but not on the whole button
programming with reports and what not. I have a few books i'm going to try
and read as well, and i'll be back if i need more help

Thanks
 
G

Guest

Here's kinda what i want to do

http://www.databasedev.co.uk/query_filter.html

I want the Combo Boxes to have the different information from my records,
but only one instance of each, say the date field has 10 entries for 6/01/06,
i don't want 10 date entries, i just want one.

Once the diffent fields are selected, the query should run leaving the blank
fields as is, meaning if the date was empty, but the id was 15, all records
with id 15 are returned.

This query, is then linked to a report, which will be previewed and/or
printed with only those specific records.
 
L

Larry Linson

Here's kinda what i want to do

http://www.databasedev.co.uk/query_filter.html

I want the Combo Boxes to have the different information from my records,
but only one instance of each, say the date field has 10 entries for
6/01/06,
i don't want 10 date entries, i just want one.

Use the Query Builder to create the Query for Row Source of your Combo Box,
and right-click in the upper part but not on any of the data source boxes
(tables or other queries). Choose "Properties", and select Unique Values.
That shoud eliminate the duplicates.

Once the diffent fields are selected, the query should run leaving the blank
fields as is, meaning if the date was empty, but the id was 15, all records
with id 15 are returned.

As you haven't explained what Fields are involved, I can't be very specific.
You'll either need to write VBA code to create the WHERE clause for the
Query (that will be used as the RecordSource of the Form or Report), in
which case, you can ignore any empty Controls, or you'll have to refer in
the Query's criteria to the Controls on the open Form in an expression that
returned no value when the Control is empty.
This query, is then linked to a report, which will be previewed and/or
printed with only those specific records.

If you'd like to clarify with details... Field names, Control names, etc.,
perhaps someone could offer more specific help.

Larry Linson
Microsoft Access MVP
 
G

Guest

I was able to get a version where you enter text into an edit box, and then
click on the preview/print button and it works, it came from
http://www.ukaug.co.uk/TPQBF.asp
it serves the purpose, but i'd like to have the boxes dropdown combo boxes.
(with only unique values)

Here's my setup (I know the naming is kinda off, but i started this db while
programming in c++ and didn't really think ahead)

Table: 'Connector Tests'
Querie: 'qryTest'
Form: 'frmTests'
Report: 'rptTestResults'

The fields i'm interested in selecting from the table are 'Serial Number'
'Date' (which is an unformatted text box) 'CustomerPO' 'DrawingNumber'
'WireTech' 'QATech' 'Customer' 'ContractNumber'

i'm sorry for beeing a noob, but it's only better to ask questions, right?
 

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