Attaching files of different types to table field thru VBA

vtrm

Registered User.
Local time
Tomorrow, 01:43
Joined
Jun 8, 2005
Messages
21
Hi Everyone,

I have a PO table. Each PO has 3 documents of multiple types (one may be Word, other may be Excel, Acrobat). When I display the PO, the attachments should be shown as Icons, which when double-clicked, will open in its own Application.

I have a pop-up screen where I enter new PO details. In this screen, I have Attach/Detach buttons for each of the Documents.

My Requirement:
When I press 'ATTACH' of Doc1, the File Selection screen should be displayed from where the user will select the file to be attached. This file should be updated into the table field "doc1".

When I press 'DETACH' of Doc1, the file in table field "doc1" must be cleared.

How can I achieve this???:mad:
 
re:

Hi,
I assume you are using an OLE datatype field for this.
I would actually recommend scratching that and using a text data type field instead.
You should probably have a separate table which only has a PK field and a text data type field which stores the full path and name to the external files. You can then link to this from your other records table to have as many attachments as you want.
At runtime to open up the files you can use the FollowHyperlink() method on the on click event of the control bound to the text table field. To attach a new file you can use this API call to open up the standard open/save dialog which will return the full string path/name to the file selected. To remove a file you would just run a delete query or delete sql on the table to remove the specific entry.
HTH
Good luck
 

Users who are viewing this thread

Back
Top Bottom