produce invoice from form

G

Guest

hi, I am new to acces so am learning and have managed a very basic table
with a form. I have several drop down lists on the form and am now trying to
create an invoice. I have created a report with the releveant details
required for the invoice taken from the table. I have put a command button on
the form and asked it to print the report put instead of printing the record
that I am working on it prints all records in the database. Can anyone
advise me on how I can print an individual record??

Struggling grandma
 
A

Al Camp

Each Invoice record should have a key unique field identifying that particular record.
Say... InvNo for example. Use an Autonumber field to generate that automagically for
each new Invoice.

Use a query (based on your Invoice table) behind your report that includes the InvNo
field in the query, with a criteria of...
=Forms!frmYourInvoiceFormNameHere!InvNo

While viewing the record you wnat to print, click the button to open the report.
Now the report will only return the one Invoice that has that InvNo your looking at.

The form should remain open while the report prints.
 
G

Guest

Hi

Behind you button you need to place ome code to tell the programme to print
only the selected record.

something like this

Private Sub ButtonName_Click()
DoCmd.OpenReport "NameOfYourReport", acViewNormal, "",
"[InvoiceRef]=[Forms]![NameOfYourForm]![InvoiceREF]", acNormal
End Sub

Leave all the "" where I have put them - just change the words.
The Name of your report and Button Name needs altering

InvoiceREF = I have put this to shown the bit of the code that referes to
the "common field" that is in your report AND on your form. So, in this case
the InvoiceRef on your orm will equall the InvoiceRef of your report
(invoice). This field name will need to be changed to whatever you use.

Oh, and don't base your form or report (the invoice) on your table. Create
a new query based on the table and use this to run the form and report.

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top