On 17 Jun 2004 13:17:38 -0700,
pm*****@thelyndco.com (Paul Mendez) wrote:
I have a form that consists of 150 records and is still growing.
there are times when I want to print a certain record of the form, say
record 12. I go to file --> print and choose the page number of the
record. But what I would like to do, to decrease the amount of
mistakes of print all 150+ records, I would like a button to only
print the record that is currently displayed on screen. I know it can
be done, I just don't know how. Any suggestions? Thanks!
First of all you shouldn't really be printing the form. Forms are for viewing, reports are for printing.
Create a report containing the same info as shown on the form. As a starting point you can right click on the form name
in the database window and select "Save as report". This will generate a report which will look the same as your form,
which you can then edit to suit your needs. (eg remove unwanted controls such as command buttons etc)
Make sure that both your form and report's recordsource contains the Primary Key field of the records.
Add a command button to your form (cmdPrint) and put the following code in the OnClick event of the button -
DoCmd.OpenReport "rptMyReport",,,"[PrimaryKeyField]=" & Me.PrimaryKeyField
Change rptMyReport to the name of your report.
Change PrimaryKeyField to the name of your primary key field.
This will print a single record report showing details of the current record in the form.
Wayne Gillespie
Gosford NSW Australia