Solved File data icon in each record on form (1 Viewer)

LjushaMisha

Registered User.
Local time
Tomorrow, 00:41
Joined
Mar 10, 2017
Messages
55
Hi everybody.

I was working with attachment field. Noticed that attachment field in reality consists of (lets say the field name is "Attach")
- Attach.FileData
- Attach.FileName
- Attach.FileType

In attachment field I have attached different files, with their names. In the form I had 3 controls.
1. Attach.FileData with program icon
2. Attach.FileName with the name of attached file and

3. Attach.FileType with file extension (i.e. .accdb)

After a certain period I found out that attachments are not best solution for my purpose.
So I have decided to go with "child" table which consists of full path names of various files which are in some way "connected" with certain project

In the form I made, I put command buttons for adding and deleting records (files full path name) an on DblClick event I open the requested file.
Everything work perfect. BUT ...
There is always BUT

I did like the Attach.FILEDATA with the icon of the program attached file was made in (i.e. Excel icon, pdf icon, dwg icon, word icon, jpeg icon, ...)

And now question: IS IT POSSIBLE TO DO SOMETHING LIKE THAT WITHOUT ACCESS ATTACHMENT FIELD.

Thanks for replay in advance
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:41
Joined
Oct 29, 2018
Messages
18,962
After a certain period I found out that attachments are not best solution for my purpose.
Hi. Just curious, could you please expound on that statement? Thank you.
 

LjushaMisha

Registered User.
Local time
Tomorrow, 00:41
Joined
Mar 10, 2017
Messages
55
Hi theDBguy.

1. I wanted that attached file is opened on double clicking on file name
In .FileName "field" I wasn't able to get full path name with LoadFromFile method - only the name of the file

2. Then I found out (some tutorials) that attachment fields are big "memory consumers"

3. For my level of knowledge is much easier to work with solution I now have: PARENT table with all Projects we have to realise and with CHILD table with all FULL PATH names of files that realisation of the certain project depends on. (Lets say Material list done in Excel, project drawing made in AutoCad, material cutting list made in some CUT program, meeting minutes made in word, notes on project flow in .txt files)

4. As each project consist maybe of 10 to 15 production working orders the number of those files is really substential

5. And I didn't want that user would have the possibility to work on attachments thru Attachment dialog box help

BR
 

moke123

AWF VIP
Local time
Today, 18:41
Joined
Jan 11, 2013
Messages
2,831
If your storing the file paths you could use shellexecute to open the files in their native program

see http://access.mvps.org/access/api/api0018.htm

I usually use a listbox with the first visible column as the filename and the second non-visible column as the path to the file.
In the doubleclick event I use the procedure in the link supplied above to open it with

Code:
call fHandleFile(me.MyListBoxName.Column(2),1)
 

LjushaMisha

Registered User.
Local time
Tomorrow, 00:41
Joined
Mar 10, 2017
Messages
55
Thanks moke123.
I'm not looking for instructions of how open files on dblClickEvent
In my continuous form (recordsource is CHILD table with full path filenames) I'd like to have a control with icons for appropriate file.

If, for example, on the form are listed 3 files:
C:\Users\documents\fileName1.xlsx
C:\Users\documents\fileName2.docx
C:\Users\documents\fileName3.pdf

I'd like to put a control with
excel icon for fileName1
word icon for fileName2
and acrobat reader icon for fileName3

is it possible? How?
 

moke123

AWF VIP
Local time
Today, 18:41
Joined
Jan 11, 2013
Messages
2,831
You can add an icon to a record in a continuous form but not sure you can use it as a clickable control .
heres an example. use the file selector to get a file path and then click add record.
I only have icons for word, excel, and pdfs in the folder but you can add to the select case statement all you need.
double click the file name to open file.
 

Attachments

  • Icons.zip
    108.3 KB · Views: 74

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:41
Joined
May 7, 2009
Messages
16,393
here is another demo.
put all files on same folder.
 

Attachments

  • ThumbFiles.zip
    232.8 KB · Views: 74

LjushaMisha

Registered User.
Local time
Tomorrow, 00:41
Joined
Mar 10, 2017
Messages
55
use an image control and populate it depending on file extension
At the end, peace of cake. As always.
I found icons I need, will make with with CASE ... is .xls ...
Thanks a lot
 

Users who are viewing this thread

Top Bottom