Run a report from a form

J

Jane

Hello,
From a form I would like to run a report. I'm using a command button to do
so and works but is displaying a report for every record. I only want to
display a report with the form information so I used the fldID as reference
to link the form with the report but still no dice. The report is using a
query to draw the information.
Howto link a report to a form?
TIA
Jane
 
K

Kevin3NF

The query needs to have the fldID for the corresponding record on the form
passed to it

Something like:

Select field1,field2
From table
Where (((Table.fldID)=[Forms]![MyForm]![fldID]));

This will cause the query to look for the open form (MyForm), pick up the
fldID and return that one record to the report.

HTH,
 
H

Hugh O'Neill

Jane said:
Hello,
From a form I would like to run a report. I'm using a command button
to do so and works but is displaying a report for every record. I
only want to display a report with the form information so I used the
fldID as reference to link the form with the report but still no
dice. The report is using a query to draw the information.
Howto link a report to a form?
TIA
Jane


Hi Jane, for your Report, use a Query as the record source in which you
have the unique record identifier Field. In the criteria for that
Field in the Query, refer to a textbox on your calling form. That
textbox is to contain the same unique identifier Field value for the
Record you are looking at and want to print.

hth

Hugh
 
J

Jane

Thank you much to you both.

The report is now displaying only one record as advertised however, query
when invoked by the report, doesn't read the fldID from my opened form, it
pops up a window asking for the fldID.
What have I done wrong?
Jane
 
K

Kevin3NF

Can you post the SQL of the query...specifically lloking for the part in the
criteria for fldID
 
J

Jane

Sure can:

SELECT tblWarranty.warrantyID, tblWarranty.BookNo
FROM tblWarranty
WHERE (((tblWarranty.BookNo)=[Forms]![frmAction]![warranty.bookNo]));

Thank you.
 
K

Kevin3NF

I would have to see your database to sort this one out....feel free to
contact me offline about sending it over.

--
Kevin Hill
3NF Consulting
www.3nf-inc.com/NewsGroups.htm



Jane said:
Sure can:

SELECT tblWarranty.warrantyID, tblWarranty.BookNo
FROM tblWarranty
WHERE (((tblWarranty.BookNo)=[Forms]![frmAction]![warranty.bookNo]));

Thank you.

Kevin3NF said:
Can you post the SQL of the query...specifically lloking for the part in the
criteria for fldID
form,
want
 

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