Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Printing from A Form - ONLY the current record

Posted on 2011-03-24
6
Medium Priority
?
408 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
[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
  • 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

715 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