Solved Selected fields from a table/query to generate Report and export to Excel & PDF in MS Access (1 Viewer)

mrk777

Member
Local time
Today, 07:50
Joined
Sep 1, 2020
Messages
60
Hi Team, Please help me build this up! I have a Master DB Table with about 34 fields and I have specific requirements filtering out the data and export the fields to Excel or PDF. I have built the queries with the requirements of the criteria. The requirement is to create a form with ListBox of all the field Headers from Master DB Table and whatever the fields I select, only those fields have to be opened in a table view, and then the user should be able to filter the values if needed from that table fields and click on Export button to Export to PDF or Excel.

I have created a form to get all the field header names.

1613561710348.png
 
Last edited:

Isaac

Lifelong Learner
Local time
Yesterday, 19:20
Joined
Mar 14, 2017
Messages
8,774
OK, guessing that's a personal message. How do I do that? I don't see his address.

He said "send me a PM if interested" in the first line of his message..................Go to the envelope icon which is immediately to the left of the Notification icon (that icon that shows a red # of notifications near upper right by Search button).
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:20
Joined
May 7, 2009
Messages
19,228
not same but almost.
indulge. don't take a pinch. take it all.
 

Attachments

  • toExcelOrPDF.accdb
    1.2 MB · Views: 112
Last edited:

ClaraBarton

Registered User.
Local time
Yesterday, 19:20
Joined
Oct 14, 2019
Messages
451
Believe me, arnelgp, I'm indulging. Although yours is a lot prettier, I got hold of Majp's form and started reworking it. I had been working on my own mess for HOURS and DAYS and now am starting over with his. Thank you so much.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:20
Joined
May 7, 2009
Messages
19,228
i updated mine, so it will only export fields available in Selected fields listbox.
the export will obey the List arrangement of that listbox.

also on exporting, it will obey the filtering of the subform.
 

Attachments

  • toExcelOrPDF.accdb
    1.8 MB · Views: 105

evictme

Registered User.
Local time
Yesterday, 21:20
Joined
May 18, 2011
Messages
168
i updated mine, so it will only export fields available in Selected fields listbox.
the export will obey the List arrangement of that listbox.

also on exporting, it will obey the filtering of the subform.
This is brilliant! Was easy to setup and get going almost immediately. Just one question, how would I adjust the code to allow users to select the folder for export?
 

ClaraBarton

Registered User.
Local time
Yesterday, 19:20
Joined
Oct 14, 2019
Messages
451
i updated mine, so it will only export fields available in Selected fields listbox.
the export will obey the List arrangement of that listbox.

also on exporting, it will obey the filtering of the subform.
I have been working long on an export/import form that actually works. I took yours, arnelgp, and ran. I added import capability, file pickers, and prettied it up to match the rest of my forms. The import function is rather specific to my needs but could be easily modified by anyone else. I can't thank you enough for allowing me to use it. Thanks anyway.
 

Attachments

  • toExcelOrPDF.accdb
    1.1 MB · Views: 122

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:20
Joined
May 7, 2009
Messages
19,228
i like Clara's version, clean code.
still old (messy code). added SQL view.
will show on SQL whether filtered and/or sorted.
added image to the buttons.

also added FileDialog.
 

Attachments

  • toExcelOrPDF_V02.accdb
    1.2 MB · Views: 103

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:20
Joined
May 7, 2009
Messages
19,228
you're welcome.
on another test, i got error when selecting a Query on the table listbox.
i modified fnUpdateZZTable to accept Query and table.
 

Attachments

  • toExcelOrPDF_V03.accdb
    1.7 MB · Views: 113

ClaraBarton

Registered User.
Local time
Yesterday, 19:20
Joined
Oct 14, 2019
Messages
451
you're welcome.
on another test, i got error when selecting a Query on the table listbox.
i modified fnUpdateZZTable to accept Query and table.
I think that
Public Function fnUpdateZZTable(ByVal tName As String)
needs to clear the zztable before appending records.
 

Users who are viewing this thread

Top Bottom