Link to home
Start Free TrialLog in
Avatar of Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.ScFlag for Zambia

asked on

How to print POS receipts in MS Access


My point of sales receipts is compiled from queries that gather the following:
(1)      Taxes
(2)      Quantity sold & prices
(3)      Other calculations
So in short it is not possible to use the current form to act as a receipt report. These queries are the one providing data for the receipt report, that is why currently to print a receipt report you need to close the current input form and open the parameter query form.
Now I’m wondering if there could a better way of binding the parameter query using the input form so that people do not need to close the current input form but can just invoke the printing of a receipt from the same input form.

I Thought MS Access save data into the table immediately after leaving a control, if yes how can I use the current primary key of the current receipt form as part of the parameter query so that the document printed is the current document showing on the input form screen?
I want to maintain the current form parameter query because sometimes the document may fail to print, then with the current parameter form query available I’m able to preview the document and reprint it.

I know it is possible to attach a macro to either print directly to the printer or preview the document by using the built in macro wizard, but the problem is how to the current document I’m not sure here because this macro wizard will only ask for the report to be printed, this means that I will end will all receipts being printed.

Could it be that there is VBA function to use here?

See how you can help here.


Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

Without inside knowledge of your application is hard to speculate but if many calculations are involved probably s good idea would be to consolidate all your desired output data to a temp table that Will act as your report recordsource .
Avatar of Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc


I know its possible to print a report using VBA but the problem is how to select the required invoice?
I would go a step further:

Receipts are fiscal relevant. Thus they must be materialized in a normal table before printing. So everything printed on it, should be calculated and stored in that table after the sale is done. And then you print it just from this table.

Another benefit: You get a second auditable trail in your system for free.
We do as Stefan does. Writing to the final table is where the invoice/receipt number is applied.
The details (invoice lines) are written to a subtable.

Then, all you need to do is to print the receipt (report) based on that single number.
All what you have said is already in both parent receipt table and receipt detail line table , all what I'm saying is how to fine tune the code below, so that I'm able to print the current receipt number after creation:

Private Sub SalesPrintDoc_Click()
DoCmd.OpenReport “rptSalesInvoice”, acViewPreview, , “invoiceID = ” & Me.invoiceID
DoCmd.PrintOut , , , , 1
End Sub

I do not know why it is not working?

I want also to be able to mark the printed copy as copy receipt and the first time print as original. Is there a way to amend the above code?
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you all it has worked!