Solved

How to print only current record?

Posted on 1997-11-17
4
317 Views
Last Modified: 2008-03-04
Hi,
Using ACCESS 2.0 I made a samall application to print receipts for customers. I have a form to input data in a table "Transactions", a Query using that table, and a button [Report] on the form to print a receipt for the current displayed record (usually the record just entered and saved). The problem is that it prints all records instead of the current record only.
Please help.
Thanks
0
Comment
Question by:abdoudiaw
  • 2
4 Comments
 

Expert Comment

by:Denver111497
Comment Utility
What are you using to determine what the "currently displayed" record is?  This is obviously where the problem lies.
 Do you want to click on a [Report] button in your form, and print the receipt? Or do you want to go to the report manually, and print any report you choose?
The answer depends on what exactly you want to do.
0
 

Author Comment

by:abdoudiaw
Comment Utility
I want to click on a [Report] button in my form, and print the receipt. Thank you for your help.
0
 

Author Comment

by:abdoudiaw
Comment Utility
Edited text of question
0
 
LVL 1

Accepted Solution

by:
RHarwood earned 50 total points
Comment Utility
Here is what you need to do:

1.  Create the button
2.  On the on click event add the following code (I am going to assume you have some Key field which I will call ReceiptNum.  You of course will have to put in your own field name.:

DoCmd DoMenuItem 0,0,4       (This saves the current record so if someone just made changes they will be committed to the database)

DoCmd OpenReport "ReceiptReport",,,"ReceiptNum = " & Me!ReceiptNum                (Note this example assumes that ReceiptNum is a number.  If your Key field is a text field then the code would be:

DoCmd OpenReport "ReceiptReport",,,"ReceiptNum = """ & Me!ReceiptNum & """"

For both of these examples the "ReceiptNum =" part is a where clause for the report.  You can put in many different things there such as if you wanted to print all the receipts for a particular customer you could use:

DoCmd OpenReport "ReceiptReport",,,"CustomerID = " & Me!CustomerID.

Hope this helps
DoCmd Oprn
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

763 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

12 Experts available now in Live!

Get 1:1 Help Now