Save current records on form as pdf

Ameer

New member
Local time
Today, 04:19
Joined
Oct 1, 2020
Messages
7
So I have been making this database for a Small online business. And I’m having trouble exporting the record on my invoice form. When I add a export button it exports all records ( all invoices I have saved), I want to export the invoice that’s selected. Is there any way on how I can save pdf of the record I’m on only.
 
Yes, you specify that record as criteria.?

How are you 'exporting' ?
Please show the code.
 
This might be a bit more complicated than you need at the moment, but I thought you might be interested in it as a possible solution for the future.

Generate Multiple Reports

 
Yes, you specify that record as criteria.?

How are you 'exporting' ?
Please show the code.
I’m just using macro Exportwithformating. It exports all the records( All invoices I have created and saved) in the form. But I would like to save and export the selected invoice which is differentiated according to an invoice number(auto number) given to each invoice. I would like to use a code that would help me save the current form selected as PDF format.
 
I’m just using macro Exportwithformating. It exports all the records( All invoices I have created and saved) in the form. But I would like to save and export the selected invoice which is differentiated according to an invoice number(auto number) given to each invoice. I would like to use a code that would help me save the current form selected as PDF format.
Hi. Are you exporting the form or a report? Can you show us your macro?
 
add Macro on the Form's Current Event:
t1.jpg

now, create a Query that will use Tempvars!tvar_invoice as it's Criteria:
t2.jpg

on the click of the button use the Query as Object Name of your ExportWithFormatting Macro:
t3.jpg
 
Hi. Are you exporting the form or a report? Can you show us your macro?
I’m exporting the form. And trying to save current record as PDF format.

so I have removed the macro and trying a code

DoCmd.OutputTo acOutputForm, “Invoice”, _
acFormatPDF, “Invoice.PDF”, True
End sub

This one still exports all records in the form but I would like to filter the record I’m on and export it only.
 
that is what my instruction is all about.
it's about creating a Filtered Query.
 
that is what my instruction is all about.
it's about creating a Filtered Query.
Yes but it exports the record as In the table. I want the form to be exported. I want the form view.
Any possibilities to filter from a code before exporting macro runs?
 
Apply filter criteria to form or build a report and apply filter to report when it opens and export report.
 
you mean the "Form" itself?
 
you mean the "Form" itself?
Yes. The form itself but the selected record only. For example I selected invoice# 1 and when I try to export it all other invoices also exports along with it. I want invoice #1 to be on the PDF only.
 
try post #11.

EDIT:
i can give you code to take a Snapshot (bmp or jpg) of the Form.
but you need Adobe Acrobat professional to convert the image to pdf.
 
Last edited:
try post #11.

EDIT:
i can give you code to take a Snapshot (bmp or jpg) of the Form.
but you need Adobe Acrobat professional to convert the image to pdf.
Yes please.
 
Re: Post #11 - apply filter to form so it has only the one record for export.

So in some event have code like:

Me.Filter = "ID=" & Me.ID
Me.FilterOn = True

The real trick is figuring out what event to put code into.

Alternatively, which is probably simpler, is to build a report and apply filter to report when it opens. This is really quite basic Access functionality.
 

Users who are viewing this thread

Back
Top Bottom