Printing one record vs. printing entire report?

  • Thread starter StargateFanFromWork
  • Start date
S

StargateFanFromWork

I've gotten to the point now where I feel comfortable creating forms and
reports and buttons to navigate between each. Here's one that's stumping
me, though. I have a print button on one form that will print out an entire
report but users will also need to print out individual records now. Can't
believe it but this hasn't been an issue before; I myself have used the
screenshot approach up until now for printing a record. But it's become a
need beyond just what a newbie developer needs to what the group needs with
regards to printing the record showing up on the screen. What is the best
way to do this as I haven't a clue on this one? <g>

Thank you! :eek:D
 
A

Albert D.Kallal

Just build your reprot as you want with all the fields, and the layout you
want.

Then, on a buttion on your form, go

me.Refresh ' this forces a disk write so the
' report will show changes made
' to the one rocord

docmd.OpenReport "reprotName",,,"id = " & me!id

That is it...two lines of code...
 
G

Graham Mandeno

The fourth argument of the OpenReport method (WhereCondition) provided a way
for you to select the record(s) to be included in the report:
DoCmd.OpenReport "MyReport", , , "[CustomerID]=99"

This will print the report selecting only a single customer.

As the argument is a string, you can build it in code before calling
OpenReport:
Dim strWhere as String
strWhere = "[CustomerID]=" & Me.CustomerID
DoCmd.OpenReport "MyReport", , , strWhere

This will use the CustomerID value from the current record on your form to
open the report.
 

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