Solved

Printing from A Form - ONLY the current record

Posted on 2011-03-24
6
348 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
Comment Utility
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 250 total points
Comment Utility
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
Comment Utility

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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:Patrick O'Dea
Comment Utility
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 250 total points
Comment Utility
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
Comment Utility
Thanks,  
I thinks I confused things with my question.

I will issue a related query.
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
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…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

772 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