want to print only one record in form view

  • Thread starter Thread starter chrisl
  • Start date Start date
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.
 
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
 
-----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.
 
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.
 
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
 
Back
Top