Printing Single Record

J

Jeremy Dove

I am having the following problem. I have a form that is
based upon a query. When I try to print it prints all
1300 records. How can i make it so that it only prints a
single record when requested. Any help would be
appreciated. Thanks
 
A

Allen Browne

Create a report that lays the data out for printing. (If you want the same
look, you can open your form in design view, and from the File menu, choose
Save As | Report.) The use the primary key value of the form in the
WhereCondition of the OpenReport action.

This example assumes you have a primary key (AutoNumber) named "ID". Place a
command button on your form, and put something like this into its Click
event procedure:

Private Sub cmdPrintRecord_Click()
If Me.Dirty Then 'Save first.
Me.Dirty = False
End If
If Me.NewRecord Then
MsgBox "Select the record to print.
Else
DoCmd.OpenReport "MyReport", acViewPreview, , "ID = " & Me.ID
End If
End Sub
 
J

Jeremy Dove

That helped me get the form layout that I wanted. However
do you know how to make it so that I don't have to go to
the preview screen. I am trying to just send it to the
printer.

Thanks in advance for your help.
-----Original Message-----
Create a report that lays the data out for printing. (If you want the same
look, you can open your form in design view, and from the File menu, choose
Save As | Report.) The use the primary key value of the form in the
WhereCondition of the OpenReport action.

This example assumes you have a primary key (AutoNumber) named "ID". Place a
command button on your form, and put something like this into its Click
event procedure:

Private Sub cmdPrintRecord_Click()
If Me.Dirty Then 'Save first.
Me.Dirty = False
End If
If Me.NewRecord Then
MsgBox "Select the record to print.
Else
DoCmd.OpenReport "MyReport",
acViewPreview, , "ID = " & Me.ID
 

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