want to print only one record in form view

C

chrisl

If i have a form open and click print preview, i see
every record. I want to only print the current record. Is
this possible? How do i do it.
 
H

Hugh O'Neill

chrisl said:
If i have a form open and click print preview, i see
every record. I want to only print the current record. Is
this possible? How do i do it.


Design a Report. Forms are not intended for this and have many
shortcomings if you try to use them for things they were not designed
to do - like printing.

hth

Hugh
 
C

chrisl

-----Original Message-----



Design a Report. Forms are not intended for this and have many
shortcomings if you try to use them for things they were not designed
to do - like printing.

hth

Hugh
.
Thanks, but reports print all records and I only want to
print one record -- say ine invoice on a page, not all
the invoices in the database. There must be a simple way
to do this.
 
F

Fredg

chrisl,
Regarding > > >Thanks, but reports print all records and I only want to
print one record -- say ine invoice on a page, not all
the invoices in the database. <<<

The above statement is absolutely not true.
Hugh gave you the correct advice.

Make a report that will print the invoices.
If your Invoice table is normalized and has a unique Prime Key field that
identifies each record, then...
On the form that shows all the records and includes that Prime Key field,
add a command button.
Code the Button's Click event:

(If that Prime Key field is of a Number datatype:)
DoCmd.OpenReport "InvoiceReport", acViewPreview, , "[RecordID] = " &
[RecordID]

(If the unique Prime Key field is of Text datatype, then use:)
DoCmd.OpenReport "InvoiceReport", acViewPreview, , "[RecordID] = '" &
[RecordID] & "'"

Change [RecordID] to what ever the actual name is of that Prime Key field.

Only the record displayed on the form will be included in the report.

Look up the OpenReport method in Access Help.
Also look up
Restrict data to a subset of records.
 
G

Graham Mandeno

Hi Chris

Reports print whatever records you ask them to print.

If you have a report that prints out, say, orders, then you can add a
WhereCondition to the OpenReport method:
DoCmd.OpenReport "rptPrintOrder", , , "OrderNum=1234"

If you are currently in a form displaying order number 1234, then you can
say:
DoCmd.OpenReport "rptPrintOrder", , , "OrderNum=" & Me.OrderNum
 

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