Images in database Access 2007 (1 Viewer)

Zlatkodo

Registered User.
Local time
Yesterday, 17:09
Joined
Mar 31, 2010
Messages
24
Which is the best way to insert images in access 2007 database ( as OLE Objects or as attachments or something else)?
Zlatkodo
 

Rabbie

Super Moderator
Local time
Today, 01:09
Joined
Jul 10, 2007
Messages
5,906
Best to store the images in a separate folder and just store the path to the image in your DB. This will cause less bloat than storing the images directly in the database
 

Zlatkodo

Registered User.
Local time
Yesterday, 17:09
Joined
Mar 31, 2010
Messages
24
Thanks for answer, Rabbie,
This is my first database and I need more information.
If my path is: C: \ Documents and Settings \ User \ Desktop \ Scheme in which way should I store the path?
How can I, in this case, show the picture in the form of my database?
I've heard for the relative path. What is it and whether I should use?
Thanks in advance.
Zlatkodo
 

Zlatkodo

Registered User.
Local time
Yesterday, 17:09
Joined
Mar 31, 2010
Messages
24
I think there are too many differences between Access 2003 and Access 2007 and it is very difficult to manage, especially for beginner who makes his first database.
Maybe somewhere I can find the answers for the Access 2007?
Thanks. Zlatkodo.
 

vbaInet

AWF VIP
Local time
Today, 01:09
Joined
Jan 22, 2010
Messages
26,374
Even though the code says for Access 2003, it will still work. From your comments it sounds like you haven't tried it. Try it first.
 

zorrodidit

New member
Local time
Today, 10:09
Joined
Apr 22, 2010
Messages
2
Hi people.

I have stumbled on something that might be very helpful, taking into account the topic here.

I have two identical tables (different data) in an Access 2007 database, with three columns that I formatted as 'hyperlink' and the data in those fields are file or folder locations. (e.g. c:/user/mydocuments/blahblah.doc)

I have a union query that queries all fields in both tables, basically joining all the data from both tables.
I have one Form that shows all the data fields.
So I can view all records in the one form and click on the hyperlinks to view such things as related photos and other related documents.
But the hyperlinks don't work, even though they were blue and the mouse cursor went to a hand with pointing finger when passed over the blue hyperlinks.

So I changed the table fields with the hyperlinks to OLE, but that didn't work either, so I changed them back to hyperlink.
Then they worked.
But changes were made to the file location text in the query hyperlink fields.
In the union query, in data-sheet view, instead of say,
c:/user/mydocuments/blahblah.doc
there was #c:/user/mydocuments/blahblah.doc#
But this change with the # was only seen in the union query.
The table fields and the form fields still had the original file location description, without the #.
I also checked the union query in it's design view (SQL view) and nothing had changed from the original statement/expression.

So now I can open my database, open the form, search for a text file 'see quote document', click and open it, and it opens in a windows explorer window, go to the accompanying field in the same form, 'see photos', click and open it, ditto, go to the last of my hyperlink fields 'view support documents, ditto.

So is this common knowledge or have I been helpful?

Cheers,
Michael.
 

Simon_MT

Registered User.
Local time
Today, 01:09
Joined
Feb 26, 2007
Messages
2,177
I would always use referential access to Images i.e. held in a folder(s). The first consideration is that if you have images for all sort of data object try to have one function to get the image. This means that each form or Report must have consistent control naming references:

Image: ImageControl
File: ImageFile

The Forms or Report RecordSource i.e. Query must prescribe the ImageFile if each Record has its own image. Now that the Form or Report has ImageFile the Path has to prescribed. As variable paths can be used this function determines the path:
Code:
Function GetImageDir() As String
    GetImageDir = "C:\Databases\Demo\Images\"
End Function

Next on a Form OnCurrent event =GetPicture()
Code:
Function GetPicture()
Dim FullPath As String
    With CodeContextObject
        FullPath = GetImageDir & .[ImageFile]
        If Dir([FullPath]) <> Empty Then
            .[ImageControl].Visible = True
            .[ImageControl].Picture = FullPath
        Else
            .[ImageControl].Visible = False
        End If
    End With
End Function
With CodeContextObject the Function doesn't care where it is being called from. ImageControl to Invisible is to handle Reports when the image is unavailable.

I create a SubReport for the images and On Print Event =GetPicture()

Simon
 

Max D

Registered User.
Local time
Yesterday, 17:09
Joined
Jul 3, 2009
Messages
91
There are 2 simple answers here, if you don't want to become programming guru at once.

Use the attachment datatype for pictures - its the best advice for beginner.

If you need more, you can try the AccessImagine component, that can hold and organize images in some folder automatically.
 

Users who are viewing this thread

Top Bottom