?
Solved

How to print only current record?

Posted on 1997-11-17
4
Medium Priority
?
336 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
[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
  • 2
4 Comments
 

Expert Comment

by:Denver111497
ID: 1959882
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
ID: 1959883
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
ID: 1959884
Edited text of question
0
 
LVL 1

Accepted Solution

by:
RHarwood earned 200 total points
ID: 1959885
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Suggested Courses

770 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