Solved

Print the current record

Posted on 1998-08-27
3
319 Views
Last Modified: 2006-11-17
  Dear Expert,
I made a form where you view the records from a table. I also made a button at the form footer using the command button wizard to print that record. But when I run it instead of printing the current record(through a Report) it keeps printing all the records sequentially. How can I make that button to print only the record fields I am viewing?
   
               Thanks again
                  George.
0
Comment
Question by:gsazeides
3 Comments
 
LVL 8

Expert Comment

by:Helicopter
ID: 1960444
check the code behind the button. It sounds like you need a where clause in there (e.g. "Where recordID=" & me.recordID)
0
 
LVL 4

Expert Comment

by:tomook
ID: 1960445
The fourth argument to DoCmd.OpenReport allows you to specify a WHERE condition. The third argument allows specifying a filter. If you have the form selecting only some records, you obviously already know or can find out how the records are filtered or selected. Just put the appropriate

Ex:
DoCmd.OpenReport "MyReport", acViewNormal, , "(Customer=5) AND (Payment>5.00)"

If you need more specifics, please supply the fields in the form, and how you select the fields to view.
0
 

Accepted Solution

by:
sanctified earned 0 total points
ID: 1960446
Your answer (2 possibilities)

Using a function:

This function will put a message box up asking for what specific page you want to print:

Function PrintPage (reportname As String) As Integer
a = InputBox("Select Page to Print")
 DoCmd Echo False
 DoCmd OpenReport reportname, A_DESIGN
 DoCmd Print A_PAGES, a, a

 DoCmd SetWarnings False
 DoCmd Close A_REPORT, reportname
 DoCmd SetWarnings True
 DoCmd Echo True

ttp_exit:
 Exit Function

ttp_error:
 DoCmd Echo True ' restore screen echo
 Resume ttp_exit

End Function

Using a macro:

DoMenuItem

MENUBAR:  DATABASE
MENU NAME:  FILE
COMMAND: PRINT

This command will bring you to a print window allowing you to choose all pages, you current selection or specified pages.

Enjoy!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now