[AccessD] Access 2007 Attachments

Ramz . ramzcbu at gmail.com
Wed Aug 25 01:14:19 CDT 2010


Thank you Jurgen for such detailed reply to my old cry for help. I actually
thought this post never made it to the discussion group because I never got
any response... until now. I've found a simple solution for the situation I
had, simple enough for my needs, but your input sure is very interesting! I
definitely have some use of this in future challenges that deal with
attachments, especially images that need to be shown somewhere. My only
concern with your approach is Windows' limitations when it comes to the
length of a path. I'm not really that good yet when it comes to dealing with
API calls and so I've no clue how to implement the wrapper approach you
mentioned.

Thank you once again for your generosity of spending time to explain a very
useful method indeed for dealing with attachments.

Best regards,
Ramil

On Tue, Jul 20, 2010 at 3:21 PM, Jurgen Welz <jwelz at hotmail.com> wrote:

>
> A database I've built includes photos of employees, contacts and equipment
> and I have a number of reports that include training certificates that
> include trainee photos.
>
>
>
> The file system has a structure that mirrors the table structure with a
> folder for any record that contains files.
>
>
>
> Given the following 3 tables as an example:  tblContact, tblEquipment,
> tblEmployee, each has an autonumber primary key.  The database path is
> determined from the connect string.  Below the path taken from the connect
> string, there is a Files folder.  Beneath that folder is a
> Mid$(strTableName, 3) folder, hence
>
>
>
> ...\database path\Files\Employee\
>
> ...\database path\Files\Contact\
>
> ...\database path\Files\Equipment\
>
>
>
> Beneath that, there is a folder bearing the primary key number for every
> record that has files.  For tblEmployee record 342, the folder is:
>
>
> ...\database path\Files\Employee\342\
>
>
>
> Should there be a need, you can add folders beneath that level for field
> level filing of documents.
>
>
>
> The Employee form has an unbound image control 'imgPhoto'.  When the
> application navigates to the record, it checks to see if a file named
> Portrait.jpg exists at the target path and if so, it sets the picture
> property of the image control and then makes it visible.
>
>
>
>            If Len(Dir("...\database path\Files\Employee\" & Me.ContactID &
> "\Portrait.jpg")) Then
>                .imgPhoto.Picture = "...\database path\Files\Employee\" &
> Me.ContactID & "\Portrait.jpg"
>                .imgPhoto.Visible = True
>            Else
>                .imgPhoto.Visible = False
>            End If
>
>
> I use the same approach for certificate reports.  This is very fast in
> execution and simple to implement.  There are a few functions I use to build
> the path via calls to mkDir.  To open the folder so created, I use a wrapper
> to the shellexecute Win API call and pass it the path and it opens the
> folder to drop in the photos or any other type of related file.
>
>
> Ciao Jürgen Welz Edmonton, Alberta jwelz at hotmail.com
>
>
>
> > From: ramzcbu at gmail.com
> > Date: Mon, 19 Jul 2010 15:26:38 -0700
> > To: accessd at databaseadvisors.com
> > Subject: [AccessD] Access 2007 Attachments
> >
> > Hello everyone,
> >
> > I'm currently working on a subform that has an attachment field in its
> data
> > source, and now I want this attachment field to be displayed in an
> unbound
> > attachment object in the main form. I've done online searches on how to
> go
> > about this, and it seemed the "best" approach is to first save this
> > attachment field's contents into a file in the HDD, and then use this
> newly
> > created file as the image source for the attachment object. The contents
> of
> > the attachment field, by the way, is a single ID photo. I'm tempted to
> use
> > this approach but worried that the disk i/o will slow things down. Does
> > anyone know of another way of dealing with attachment fields and unbound
> > attachment objects?
> >
> > Thank you in advance!
> >
> > -- Ramil
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
>
> _________________________________________________________________
> Turn down-time into play-time with Messenger games
> http://go.microsoft.com/?linkid=9734385
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list