Question about PrintOut Method

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form in Access 2003 I use to display student records. I want to be
able to print the record that is currently displayed in the form so I created
a button that uses the PrintOut Method (DoCmd Printout acpages, 1 ,1). It
prints a record but it's the first record in the table no matter which
student I have displayed, not the record I have on the Form. What am I doing
wrong?
 
Try the acSelection option instead of acPages. You won't need to specify and
page numbers for this option. If that doesn't work and you are getting one
page per record if you print more than one record, change the page number to
match the current record's number.

Example:
DoCmd.Printout acSelection
or
DoCmd.Printout acPages, Me.Recordset.AbsolutePosition + 1,
Me.Recordset.AbsolutePosition + 1

The AbsolutePosition property is zero based, so you need to add one to get
the record number.
 
It's always better to create a report to print the record, printing the form
won't always give the desire output, form are not ment to be printed.

the PrintOut will print all the records, and this is why it start with the
first record.
For you test try

DoCmd Printout acpages, Me.CurrentRecord , Me.CurrentRecord
 
That code did not work. I got an error "expected end of statement" after the
acpages syntax.

I know I can write a report but the screen contains numerous fields and the
client wants the report to look exactly like the form so I thought it would
be simpler to print the form. If there is no other way to do it then I guess
I will write the report. Is there a way to design a report to use the form
for the template?
 
Back
Top