Saving Invoice as PDF

M

Melissa

Hi there

I have a form "Jobs" On this form I select "Client", and insert Vehicle
details, etc. This is for a Windscreen Repair Database.

Now, on this "Jobs" form, I would like to insert a Command button - "Invoice
Now".. by clicking this button, I would like to generate an invoice for the
particular job. I would also like this button to save the invoice as pdf,
and Preferrably when the user types in the name of the invoice and saves it,
they mustnt have to type .pdf at the end of the file name.

I would also like to insert a tick box next to the "invoice Now" button,
which must automatically "tick" once "Invoice Now" has been clicked on.

Then also, I have seen on a similar database to mine, that on the "Jobs"
form, at the top right corner, there can be a combo box in which you can
select the invoices which have been generated for a particular job and by
selecting the particular invoice from the list, the invoice opens.

Please could someone assist me with this....I think I will be ok with the
design of the invoice, i just dont know how to do the command button which
saves the report, as well as the tick box

Thank you kindly

Melissa
 
A

Al Campagna

Melissa,
It's best not to work on more than one problem per post.
I'll try to handle the first two... you can always repost on your third
item, if you get no responses on that.

1. Try http://freepdf-xp.en.softonic.com/
It (freeware) allows you to send/save Access reports in PDF format.

2. Create a new field in your Invoice table, ex. HasPrinted. Make
it a Boolean True/False field.
Place a checkbox control on your form, bound to the HasPrinted
field, and when the PrintInvoice button is clicked, set HasPrinted = True
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
A

Albert D. Kallal

Melissa said:
Hi there

I have a form "Jobs" On this form I select "Client", and insert Vehicle
details, etc. This is for a Windscreen Repair Database.

Now, on this "Jobs" form, I would like to insert a Command button -
"Invoice Now".. by clicking this button, I would like to generate an
invoice for the particular job.

Okay we're going have to break this down into a few steps here, the first
problem is the above problems need to solve, this will be accomplished by
you building a report that lays out the information that looks like your
invoice. Some people try to develop a form and try to print that, but access
does not take very well to having a form printed, so build a report based on
the same data source as your form. once you get this report late out and
working the way you want, then you need some code that only prints the
current record that you're on for that given report that you've built.

So, our code to print that report would look like:

if me.Dirty = True then
me.Dirty = false
end if

' the above forces the current record you are working on to be saved to
disk.
' this than allows us to launch a report based on the current record.

docmd.OpenReport "rptInvoice",acViewPreview,,"id = " & me!id

The "id = " & me!id is the secret to making the report only print the
current record we are viewing.

Once we get the above working on the next step would be to convert this
report to a pdf file. you've course at this point not mentioned what is the
name and location as to where you want to save this pdf file. Furthermore is
there a possibility that you plan to e-mail this pdf invoice? Thus, it would
be a really great idea to consider in the future that you click on a button,
the pdf invoice is created, then you launch outlook with a person's e-mail
name taken from a email field on the form, and the pdf file is "already"
attached to the email ready to go....

However let's not get ahead of ourselves! Once we got the report working and
it prints exactly the way you want, the next step is to get some system that
allowed you to convert this report to a pdf. About the best and simplest
solution available is the free pdf creator from Stephens. The advantage of
this system is that allows you to specify the output file name for your pdf
file. I also prefers this solution as it means you don't have to install a
printer driver, nor do you have to change your current default printer to
make this thing work. you'll find Stephens solution here:

http://www.lebans.com/reporttopdf.htm

I would also like this button to save the invoice as pdf, and Preferrably
when the user types in the name of the invoice and saves it, they mustnt
have to type .pdf at the end of the file name.

You can even perhaps base the file name on an invoice number or some other
field already in the form? If not, then you either prompt the user for the
invoice number, or provide a textbox on the form in which the invoice number
needs to be entered, and we use that as part of the file name for the pdf
file name.
I would also like to insert a tick box next to the "invoice Now" button,
which must automatically "tick" once "Invoice Now" has been clicked on.

You could place behind a button that prints the invoice the following code
something like:

me.invoiceTickField = True
'...then code to print invoice follows
Then also, I have seen on a similar database to mine, that on the "Jobs"
form, at the top right corner, there can be a combo box in which you can
select the invoices which have been generated for a particular job and by
selecting the particular invoice from the list, the invoice opens.

The above now is a little bit more complex and may involve changing your
table structures and the design of your database. It's not clear if the one
record you're looking at can have many different invoices attached to it,
and each time you print do you generate a new invoice number? At this point
it's not clear how we're going to generate new invoice numbers anyway. You
might want to come up with some possible ideas as to the approach you plan
to use for generation of invoice numbers.

I guess what's not clear here is what is the relationship of that particular
combo box to the current record your are currently viewing. Or is that combo
box just a list of all invoices in the database regardless of the current
record we are actually viewing? You'll likely have to explain this process
further and in much more details as to what your actually trying to
accomplish here. Unfortunately this questions is buried deep inside of post
with a topic called "saving invoices as pdf" It is unlikely that regular
viewers here who have some ideas on this particular idea and solution will
understand or even realize that such a question is buried deep within a
question talking about pdf creation.
Please could someone assist me with this....I think I will be ok with the
design of the invoice, i just dont know how to do the command button which
saves the report, as well as the tick box

Well from the access side your not really going to be saving the invoice
which is a report. That invoice will be generated from information you have
within the database. You might save some information such as the invoice
number, perhaps the invoice date, who made the invoice and a few other
particular details. Without knowing some of your table structures it hard to
guess how this information is going to be saved. I guess one would likely
assume that you have a classic invoice type table structure in which you
have also a few related tables for things like the invoice details etc...

The trick in approaching this is to break it down into simple little tasks
and separate things. As I said I think the first task is to design a report
that lays out your information in the correct fashion. This report would be
based on the same "tables" as the invoice form. Then we design a way to
implement single printing of one invoice. Then we implement the invoice
numbering system. Then we implement the pdf printing system. Then we can
implement some prompt system for the pdf file name, and then we can move on
to other things like the combo box question etc.
 
M

Melissa

Hi,

Thank you very much for who is assisting me.

I have put a command button on my "Jobs" form - "InvoiceNow", which once
clicked, a tick box is ticked.
This is working fine. However, when i click on invoice, my report "Invoice"
is showing duplicates. It is still showing only the specified record on the
form, using "Forms!Jobs!JobNo" , however it is showing the same job no
twice. I have added a new client to my database, and i think the problem is
that each time i add a new client, it adds it 2 or three times. this is
probably why i have the same client showing twice on the same job no.

Why are my clients added twice? in the table "clients", "clientId" is set
to indexed/yet/no duplicates?

Thank you kindly

Melissa
 

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

Top