Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 424
  • Last Modified:

Printing from A Form - ONLY the current record

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
Patrick O'Dea
Asked:
Patrick O'Dea
  • 3
  • 2
2 Solutions
 
clarkscottCommented:
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
 
peter57rCommented:
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
 
Patrick O'DeaAuthor Commented:

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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
Patrick O'DeaAuthor Commented:
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
 
clarkscottCommented:
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
 
Patrick O'DeaAuthor Commented:
Thanks,  
I thinks I confused things with my question.

I will issue a related query.
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now