Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Printing from A Form - ONLY the current record

Posted on 2011-03-24
6
Medium Priority
?
418 Views
Last Modified: 2012-05-11
See attached.
Click MainMen.
Click "Process Sales Calls"
You will see a datasheet.
Click on first record (2230) on the right where the "CLICKME" is.

Next screen is headed "Update Customer Details..."

Click the BIG red button marked "PRINT".
This button calls "rptOrderDetails"

However, I want only the SINGLE order that is on the form to be printed.  This should result in one A4 page with the order details.

I have tried various "Where" conditions but I get either too much or too litte data.



EETHUR.zip
0
Comment
Question by:Patrick O'Dea
  • 3
  • 2
6 Comments
 
LVL 20

Expert Comment

by:clarkscott
ID: 35205885
Forms aren't really designed to print.  Reports are for printing.  You can easily make a report by 'copy-and-paste' method from a form.  Subforms get a little tricky since you have to create (sub) reports for each subreport.

The only way to print a FORM for a selected record is to open for the form to ONLY that desired record.

Sorry... that's pretty much how it works.

Scott C
0
 
LVL 77

Accepted Solution

by:
peter57r earned 1000 total points
ID: 35206269
Sorry, but I'm afraid you won't like this response.

Looking at the design of the Customer/order form, it seems to me that your app will only work correctly if you only ever have one order from a customer.  That is, every order is from a different customer.

The general design principle for ordering systems is that you must collect and save the data values that existed at the time the order was processed.  It seems to me that if you changed any of the data relating to customer, those changes would then be applied to any previous orders held in the system for that customer.  

This issue leads directly to your current problem with printing.  There is no self contained printable 'order' with which to associate all the order lines in the subform.  If you look at the Northwind example database you will see that it uses the 'conventional' order structure, which is an Order Header, containing data which is common to all items in the order, such as customerid, delivery address, shipping costs and so on.  It then has an Order Details table which pretty well  corresponds to your subform data.
In your app the nearest thing you have to an order header appears to be the Quote table.  In my view what needs to be happening is that the main form should be based on the quote record and all the data that is looked up from the customer record should be saved as part of the Quote record.  You can't let it be looked up automatically after the event because it might have changed since the order was created.

If you adopt this approach the issue of printing an 'order' becomes trivial since you just quote the order number (quote id) for your report.

I need to say that my comments are based on a brief look at the file and if there other parts of the app which address my concerns then I will not have found them because I concentrated on the form with the Print button.
In that case you can probably ignore all of this.




0
 

Author Comment

by:Patrick O'Dea
ID: 35206317

Thanks Scott,

"The only way to print a FORM for a selected record is to open for the form to ONLY that desired record."

I am not 100% on what you mean

I may not have made my original post sufficiently clear.

(Background: Each customer will have ONLY one order).

For Example: I will be in a form with an order for Customer "C0001" being the only customer displayed.  I now want to click a button to print an "Order Confirmation" for customer "C0001".

Is it not possible just to pass an argument from the Form to the report?   (The argument being the single unique identifier for the customer).  It is similar to a screen dump - but formatted better.

0
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!

 

Author Comment

by:Patrick O'Dea
ID: 35206351
Hi Peter,

... I am just reading your post.
I have not absorbed it all but your initial comment about "1 order per customer " is exactly the case.
I fully appreciate that this is not the norm.

I will now resume reading your post - which looks as comprehensive as ever .....




0
 
LVL 20

Assisted Solution

by:clarkscott
clarkscott earned 1000 total points
ID: 35206393
I will admit I didn't examine your project.  My comment was strictly based on my knowledge of Access.

If you fliter your form to a specific record, then only that record 'exists' in the underlying record source.

dim vid as long
vid = YourSelectedPrimaryKeyPerDesiredRecord   -  provided it's a long integer.

Docmd.openform "yourformname',,,"ID = " & vid

Your form only opens to the designated record(s).  Only designated records will 'form print'.
Scott C
0
 

Author Closing Comment

by:Patrick O'Dea
ID: 35207644
Thanks,  
I thinks I confused things with my question.

I will issue a related query.
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses

971 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