Solved

Print the current record

Posted on 1998-08-27
3
327 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

724 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