A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Pictures/Images in Tables



 
 
Thread Tools Display Modes
  #21  
Old July 8th, 2009, 06:12 PM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Pictures/Images in Tables

On Wed, 8 Jul 2009 03:13:09 -0700, adrian007uk
wrote:

Thanks John

I have made the changes you have suggested.

I have a table (TableImagePath) containing just G:\VinylImages\

and in the other table (VinylTable) i have rows including the text row
called 'Picture' that contains the image name e.g., Vinyl1.jpg

If i put G:\VinylImages\Vinyl1.jpg in the VinylTable and make a form and set
an Image control to 'Picture' the jpg shows up (brilliant!).

When i concatenate TableImagePath and Picture and get the expression to show
G:\VinylImages\Vinyl1.jpg. However this does not show any jpg?

Could you please try and help me find out where i am going wrong.

Thanks


Sure. Please post your code; it's a bit hard to tell where you're going wrong
when you don't tell us where you're going!
--

John W. Vinson [MVP]
  #22  
Old July 8th, 2009, 09:50 PM posted to microsoft.public.access.tablesdbdesign
adrian007uk
external usenet poster
 
Posts: 67
Default Pictures/Images in Tables

Besides what i have explained above I used a query to combine 'Image Path'
with 'Picture'.

I used Expr1: [Image Path] & "" & [Picture]

This created G:\Vinyl Image\Vinyl1.jpg
G:\Vinyl Image\Vinyl2.jpg
G:\Vinyl Image\Vinyl1.jpg

ETC

When i try and point the image control to this query i get nothing!

When i type the full file path in the text box of the 'Picture' row in the
'Vinyl Table' and set the image control to 'Picture' the image is there.

"John W. Vinson" wrote:

On Wed, 8 Jul 2009 03:13:09 -0700, adrian007uk
wrote:

Thanks John

I have made the changes you have suggested.

I have a table (TableImagePath) containing just G:\VinylImages\

and in the other table (VinylTable) i have rows including the text row
called 'Picture' that contains the image name e.g., Vinyl1.jpg

If i put G:\VinylImages\Vinyl1.jpg in the VinylTable and make a form and set
an Image control to 'Picture' the jpg shows up (brilliant!).

When i concatenate TableImagePath and Picture and get the expression to show
G:\VinylImages\Vinyl1.jpg. However this does not show any jpg?

Could you please try and help me find out where i am going wrong.

Thanks


Sure. Please post your code; it's a bit hard to tell where you're going wrong
when you don't tell us where you're going!
--

John W. Vinson [MVP]

  #23  
Old July 8th, 2009, 11:22 PM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Pictures/Images in Tables

On Wed, 8 Jul 2009 13:50:01 -0700, adrian007uk
wrote:

Besides what i have explained above I used a query to combine 'Image Path'
with 'Picture'.

I used Expr1: [Image Path] & "" & [Picture]

This created G:\Vinyl Image\Vinyl1.jpg
G:\Vinyl Image\Vinyl2.jpg
G:\Vinyl Image\Vinyl1.jpg

ETC

When i try and point the image control to this query i get nothing!

When i type the full file path in the text box of the 'Picture' row in the
'Vinyl Table' and set the image control to 'Picture' the image is there.


I would suggest using code in the form's Current event to push the filename
into the image control:

Private Sub Form_Current()
If Not IsNull(Me![Picture]) Then
Me![Imagecontrol].Picture = Me![Image Path] & Me![Picture]
End If
End Sub

This assumes that either Image Path ends with a \ delimiter, or Picture starts
with one - otherwise you'll need to concatenate that in as well.
--

John W. Vinson [MVP]
  #24  
Old July 9th, 2009, 05:27 PM posted to microsoft.public.access.tablesdbdesign
adrian007uk
external usenet poster
 
Posts: 67
Default Pictures/Images in Tables

Hi John

I have tried your code but the database does not like the line:

Me![Imagecontrol].Picture = Me![Image Path] & Me![Picture]

It is the 'Image Path' that access apparently can't find!

I have checked the spelling and made sure the expression matches exactly so
i cannot work out why the code will not run.

Adrian

"John W. Vinson" wrote:

On Wed, 8 Jul 2009 13:50:01 -0700, adrian007uk
wrote:

Besides what i have explained above I used a query to combine 'Image Path'
with 'Picture'.

I used Expr1: [Image Path] & "" & [Picture]

This created G:\Vinyl Image\Vinyl1.jpg
G:\Vinyl Image\Vinyl2.jpg
G:\Vinyl Image\Vinyl1.jpg

ETC

When i try and point the image control to this query i get nothing!

When i type the full file path in the text box of the 'Picture' row in the
'Vinyl Table' and set the image control to 'Picture' the image is there.


I would suggest using code in the form's Current event to push the filename
into the image control:

Private Sub Form_Current()
If Not IsNull(Me![Picture]) Then
Me![Imagecontrol].Picture = Me![Image Path] & Me![Picture]
End If
End Sub

This assumes that either Image Path ends with a \ delimiter, or Picture starts
with one - otherwise you'll need to concatenate that in as well.
--

John W. Vinson [MVP]

  #25  
Old July 9th, 2009, 09:43 PM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Pictures/Images in Tables

On Thu, 9 Jul 2009 09:27:02 -0700, adrian007uk
wrote:

Hi John

I have tried your code but the database does not like the line:

Me![Imagecontrol].Picture = Me![Image Path] & Me![Picture]

It is the 'Image Path' that access apparently can't find!

I have checked the spelling and made sure the expression matches exactly so
i cannot work out why the code will not run.


Assuming that your path table is named tblImagePaths and that the field is
named [Image Path] then you could just leave tblImagePaths out of the form's
recordsource entirely, and look it up as needed:

Me![Imagecontrol].Picture = DLookUp("[Image Path]", "tblImagePaths") &
Me![Picture]

--

John W. Vinson [MVP]
  #26  
Old July 9th, 2009, 10:45 PM posted to microsoft.public.access.tablesdbdesign
adrian007uk
external usenet poster
 
Posts: 67
Default Pictures/Images in Tables

Sorry John,

It's still not working. Do i need to put this new code as an 'OnCurrent'
event or somewhere else?

Adrian

"John W. Vinson" wrote:

On Thu, 9 Jul 2009 09:27:02 -0700, adrian007uk
wrote:

Hi John

I have tried your code but the database does not like the line:

Me![Imagecontrol].Picture = Me![Image Path] & Me![Picture]

It is the 'Image Path' that access apparently can't find!

I have checked the spelling and made sure the expression matches exactly so
i cannot work out why the code will not run.


Assuming that your path table is named tblImagePaths and that the field is
named [Image Path] then you could just leave tblImagePaths out of the form's
recordsource entirely, and look it up as needed:

Me![Imagecontrol].Picture = DLookUp("[Image Path]", "tblImagePaths") &
Me![Picture]

--

John W. Vinson [MVP]

  #27  
Old July 10th, 2009, 02:13 AM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Pictures/Images in Tables

On Thu, 9 Jul 2009 14:45:01 -0700, adrian007uk
wrote:

Sorry John,

It's still not working. Do i need to put this new code as an 'OnCurrent'
event or somewhere else?


Sorry, yes - I intended On Current.

Please post your tablenames, fieldnames, controlnames and code if this isn't
working.
--

John W. Vinson [MVP]
  #28  
Old July 10th, 2009, 08:45 AM posted to microsoft.public.access.tablesdbdesign
adrian007uk
external usenet poster
 
Posts: 67
Default Pictures/Images in Tables

Hi John

I have 2 tables. The first table is called 'Records'. It contains the
following:

Number: Auto number
Title: Text
Artist: Text
Pictu Text

This table has been populated with five (made up) records.

I have a second table called TbleImage Path. It has one field:
Image Path: Text

The tables are not linked.

The 'Picture' contained vinyl1.jpg etc

The 'Image Path' contained G:\Vinyl Images\

I then made a query (TbleImagePath Query):

Expr1: [Image Path] & "" & [Picture]

I unticked the image path and picture tick boxes just to show:
G:\Vinyl Images\vinyl1.jpg
G:\Vinyl Images\vinyl2.jpg

etc

I then made a form based on the 'Records' table. I then set the 'Picture'
field to look at the TbleImagePath Query).

This does not show the jpg.

If i type the full path G:\Vinyl Images\vinyl1 directly into the 'Picture'
record in the 'Records' table ands et the control source to'Picture' in the
'Records' form the jpg show up no problem.

The code i have used is the code(s) yop have posted but the debugger informs
me it cannot find either 'Image Path' or 'Picture' fields.

Adrian


"John W. Vinson" wrote:

On Thu, 9 Jul 2009 14:45:01 -0700, adrian007uk
wrote:

Sorry John,

It's still not working. Do i need to put this new code as an 'OnCurrent'
event or somewhere else?


Sorry, yes - I intended On Current.

Please post your tablenames, fieldnames, controlnames and code if this isn't
working.
--

John W. Vinson [MVP]

  #29  
Old July 10th, 2009, 09:09 PM posted to microsoft.public.access.tablesdbdesign
adrian007uk
external usenet poster
 
Posts: 67
Default Pictures/Images in Tables

Hi Keith

Thanks for your contribution to my problem. John has been trying to help me
but i am willing to give your advice ago. Could you please tell me where i
should put your code i.e., in the query, the table, or the form?

Adrian

"Keith Wilby" wrote:

"adrian007uk" wrote in message
...

I have read up on best practice conerning displaying images in a database.

I am planning to link the images from my PC. What i would like to know is
if the location of ther folder where the images are stotred changes (e.g.,
from 'C' to 'D') is there any way it can be changed within the database
quicly without having to change every image location as well?

Thanks in advance for any suggestions.


Just a thought, and I've not tested this so there might be a red herring
element, but if your images are all in the same generic location, eg
X:\MyFolder\MyImages\ ... then you *could* store this location in a lookup
table and use DLookup to return it. So in your query you could have a
calculated field

ImageLocation: DLookup("MyField", "tblMyTable") & [ImageFolder]

where [ImageFolder] is a field to store the " ... " element of
"X:\MyFolder\MyImages\ ... "

.... and if the location changes, say to X:\MyOtherFolder\MyImages\ ...

then you only need change it once in the lookup table.

Keith.
www.keithwilby.co.uk


  #30  
Old July 18th, 2009, 07:20 PM posted to microsoft.public.access.tablesdbdesign
adrian007uk
external usenet poster
 
Posts: 67
Default Pictures/Images in Tables

Hi John

I have posted my tablenames and fieldnames below. If it helps i can send my
database!

Adrian

"John W. Vinson" wrote:

On Thu, 9 Jul 2009 14:45:01 -0700, adrian007uk
wrote:

Sorry John,

It's still not working. Do i need to put this new code as an 'OnCurrent'
event or somewhere else?


Sorry, yes - I intended On Current.

Please post your tablenames, fieldnames, controlnames and code if this isn't
working.
--

John W. Vinson [MVP]

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.