Save current records on form as pdf (1 Viewer)

Ameer

New member
Local time
Today, 18:36
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.
 

Gasman

Enthusiastic Amateur
Local time
Today, 13:36
Joined
Sep 21, 2011
Messages
14,041
Yes, you specify that record as criteria.?

How are you 'exporting' ?
Please show the code.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 13:36
Joined
Jul 9, 2003
Messages
16,244
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

 

Ameer

New member
Local time
Today, 18:36
Joined
Oct 1, 2020
Messages
7
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.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:36
Joined
Oct 29, 2018
Messages
21,357
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?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:36
Joined
May 7, 2009
Messages
19,169
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
 

Ameer

New member
Local time
Today, 18:36
Joined
Oct 1, 2020
Messages
7
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.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:36
Joined
May 7, 2009
Messages
19,169
that is what my instruction is all about.
it's about creating a Filtered Query.
 

Ameer

New member
Local time
Today, 18:36
Joined
Oct 1, 2020
Messages
7
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?
 

June7

AWF VIP
Local time
Today, 05:36
Joined
Mar 9, 2014
Messages
5,423
Apply filter criteria to form or build a report and apply filter to report when it opens and export report.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:36
Joined
May 7, 2009
Messages
19,169
you mean the "Form" itself?
 

Ameer

New member
Local time
Today, 18:36
Joined
Oct 1, 2020
Messages
7
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.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:36
Joined
May 7, 2009
Messages
19,169
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:

Ameer

New member
Local time
Today, 18:36
Joined
Oct 1, 2020
Messages
7
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.
 

June7

AWF VIP
Local time
Today, 05:36
Joined
Mar 9, 2014
Messages
5,423
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

Top Bottom