Question about PrintOut Method

S

Stonewall

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?
 
W

Wayne Morgan

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.
 
O

Ofer Cohen

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
 
S

Stonewall

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?
 

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