Image Control (1 Viewer)

speakers_86

Registered User.
Local time
Yesterday, 20:36
Joined
May 17, 2007
Messages
1,919
Ive got 5 images on a form using the image control. Will that result in bloat?
 

thunder

Just Want To Know More
Local time
Yesterday, 17:36
Joined
Feb 28, 2009
Messages
26
Bloating !!!! yes and very so change it to a text box containing the image path and then with a small image frame with data source the textbox you created so the images will be linked not embeded
 

speakers_86

Registered User.
Local time
Yesterday, 20:36
Joined
May 17, 2007
Messages
1,919
So I'm trying to link it now, but I am having a hard time. Heres what Ive got. frmHome has a tab called menu. On this tab there are 6 images, where if you click on any one, another form pops up. So for ImageWorkOrder, how do I link that to tblImages.[imagepath] where the image id=1?
 

speakers_86

Registered User.
Local time
Yesterday, 20:36
Joined
May 17, 2007
Messages
1,919
The problem with that is that I am not displaying an image per record (the code does not let me specify which record in tblimages to use). I think what I will try is to query imageid=1 and then create a form based on that. Then I can use that as a subform in frmHome. So I will have six different subforms all based on queries that search for imageid=x.
 

boblarson

Smeghead
Local time
Yesterday, 17:36
Joined
Jan 12, 2001
Messages
32,059
What actual code are you using to assign the pic you want? It should be fairly straightforward.
 

speakers_86

Registered User.
Local time
Yesterday, 20:36
Joined
May 17, 2007
Messages
1,919
I havent actually done it yet, but heres what your link says.

Code:
Private Sub Form_Current()
On Error Resume Next
Me![ImageFrame].Picture = Me![ImagePath]
End Sub
 

boblarson

Smeghead
Local time
Yesterday, 17:36
Joined
Jan 12, 2001
Messages
32,059
So, for your purpose I would change to the form open event and use:

Code:
Me![ImageFrame].Picture = DLookup("[YourFieldNameWithPath]","YourTableNameHere", "[YourIDFieldNameHere]=1")
And similar for the next one, etc.
 

speakers_86

Registered User.
Local time
Yesterday, 20:36
Joined
May 17, 2007
Messages
1,919
Yes, that looks good. Thanks. Ill give it a try right now.
 

speakers_86

Registered User.
Local time
Yesterday, 20:36
Joined
May 17, 2007
Messages
1,919
Thats seems to be working fine, except it doesnt want to work with a relative path.
 

speakers_86

Registered User.
Local time
Yesterday, 20:36
Joined
May 17, 2007
Messages
1,919
Your code works fine. Im not using the relative path. It would be nice if I could, but when I tried, it didnt work.
 

boblarson

Smeghead
Local time
Yesterday, 17:36
Joined
Jan 12, 2001
Messages
32,059
Your code works fine. Im not using the relative path. It would be nice if I could, but when I tried, it didnt work.

What I was asking is what were you using for a relative path? It won't work like a web relative path, but you can set it based on the database location.
 

speakers_86

Registered User.
Local time
Yesterday, 20:36
Joined
May 17, 2007
Messages
1,919
Heres the full

C:\Users\Shawn\Documents\Chaos\V3.0\Graphics\Work Orders.jpg

and the partial

Graphics\Work Orders.jpg
 

boblarson

Smeghead
Local time
Yesterday, 17:36
Joined
Jan 12, 2001
Messages
32,059
So you should be able to do it like:

Code:
Const strPath As String = "C:\Users\Shawn\Documents\Chaos\V3.0\"
Dim strFullPath As String

strFullPath = strPath & DLookup("[YourFieldNameWithPath]","YourTableNameHere", "[YourIDFieldNameHere]=1")

Me![ImageFrame].Picture = strFullPath

Although I think I would store the other part of the path (the first part) in a table too and then get that when you need it so then it can be changed without changing code.
 

speakers_86

Registered User.
Local time
Yesterday, 20:36
Joined
May 17, 2007
Messages
1,919
Thanks for the suggestion, but coding the first part of the path kind of defeats the purpose. I am programming on my laptop. When I am done, the db will not be on my laptop. Thats why I was trying to use the relative path, so that once the db is moved, I wont have to change that paths of the images.
 

boblarson

Smeghead
Local time
Yesterday, 17:36
Joined
Jan 12, 2001
Messages
32,059
Thanks for the suggestion, but coding the first part of the path kind of defeats the purpose. I am programming on my laptop. When I am done, the db will not be on my laptop. Thats why I was trying to use the relative path, so that once the db is moved, I wont have to change that paths of the images.

That's why I suggested a table to store the first part. However, if it will be in subfolders from the current access app, then you can use:

Code:
Dim strFullPath As String

strFullPath = [COLOR="Red"]CurrentProject.Path & "\" [/COLOR]& DLookup("[YourFieldNameWithPath]","YourTableNameHere", "[YourIDFieldNameHere]=1")

Me![ImageFrame].Picture = strFullPath
 

speakers_86

Registered User.
Local time
Yesterday, 20:36
Joined
May 17, 2007
Messages
1,919
Yes, thats exactly what I was looking for. As usual, you nailed it.
 

samia

Registered User.
Local time
Today, 03:36
Joined
Feb 19, 2004
Messages
51
Hi Bob,

First I must apologise for asking my question this way...but was search for answers & my happen to be similar to this. I'm creating a database that will have so many photos and I want to use relative path. However, for purposes of the users....can I have two tables say; table1 main database has plant names etc etc and table2 imageID imagepath? How would I code.

Thank you in advance,

Samia
 

brian1

New member
Local time
Yesterday, 20:36
Joined
Jun 15, 2009
Messages
3
I'm trying to reduce bloat in an Access 2003 employee database. There's a field called Picture which currently has OLE embedded pictures in .doc files. If I delete the Picture field, my .mdb file goes from 2G to 2M in size; clearly my solution.

According to this thread and the MS Access 2007 "Inside Out" book, I can replace the OLE field type with a text type so that each row contains the relative path to an external jpg file, rather than embedding all those pictures.

My question is - will this technique work in an Access 2003 database, just as described here and in the Access 2007 book? The book seems to imply that this is a new 2007 feature. The thread here doesn't mention Access versions.

If I can do it in Access 2003, that would be preferable, as I wouldn't have to upgrade the mdb files to accdb and thus have to change embedded code that points to the mdb file names.

Are the techniques described here applicable to Access 2003?

thanks,
brian
 

Users who are viewing this thread

Top Bottom