Solved

Printing from A Form - ONLY the current record

Posted on 2011-03-24
6
368 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 250 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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 250 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
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.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

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