Run a report from a form

  • Thread starter Thread starter Jane
  • Start date Start date
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
 
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,
 
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
 
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
 
Can you post the SQL of the query...specifically lloking for the part in the
criteria for fldID
 
Sure can:

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

Thank you.
 
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
 
Back
Top