VBA code and buttons for downloading, uploading and printing a file attached to the attachment field (1 Viewer)

Onem

New member
Local time
Today, 19:43
Joined
Feb 20, 2023
Messages
2
Hi,
I have a database (ms access 2016) in which I separate the materials according to their characteristics and relate them with its creator who prepared it, the unit and topic it belongs to. I display materials in forms and reports and there is an attachment field where I put the material as pdf, image or word document. I want to put buttons that will make the "upload" action in the form and "download" and "print" in the report. I couldn't do it because I'm not knowledgeable in VBA. For example, when I add access's own print button, it prints the whole report, but I want it to print only the attachment, not the whole report, likewise, I want it to download only the attachment (for example, the pdf document in the attachment) and open my file explorer to upload the file to the attachment from the computer. How do I bind these buttons to the attachment field with VBA code?
 

Bilbo_Baggins_Esq

Registered User.
Local time
Today, 11:43
Joined
Jul 5, 2007
Messages
586
Please define what you mean by "upload" and "download."
Upload from where and to where?
Download from where and to where?

Are these download attachments contained in the database or do they live as files on a share?
When you want attachments to be uploaded, are you inserting them in the database or copying them to a share and creating a link to the file?
 

Bilbo_Baggins_Esq

Registered User.
Local time
Today, 11:43
Joined
Jul 5, 2007
Messages
586
Please define what you mean by "upload" and "download."
Upload from where and to where?
Download from where and to where?

Are these download attachments contained in the database or do they live as files on a share?
When you want attachments to be uploaded, are you inserting them in the database or copying them to a share and creating a link to the file?
The reason I ask is it really is NOT recommended to store attachments in the database.
Get's REALLY big REALLY fast.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:43
Joined
Oct 29, 2018
Messages
21,474
I want to put buttons that will make the "upload" action in the form and "download" and "print" in the report.
Hi. Welcome to AWF!

You could look in here for some ideas, but the Print requirement will probably need an API approach (or at least a ShellExecute one).
 

Onem

New member
Local time
Today, 19:43
Joined
Feb 20, 2023
Messages
2
I inserted the files to the database; they are not links. I want to upload the files from any computer to the attachment and download them to any computer. My database will be used by a teacher so the files should not have the feature of uploading it to a specific folder on a computer. I can print the attachment after opening it, but I want the user to be able to do it directly so it is more user-friendly. How can I do it with a link, should I make the data type a hyperlink? If I do, what will its code be like?
 

Users who are viewing this thread

Top Bottom