Photographs Database

M

Mick B

Hi

I'd like to insert photographs into my productdatabase and i used OLE-object
as a datatype for the field i want to store Jpeg files. This doesn't work.
What is wrong with te picture?

Tx

Mick
 
C

ChrisM

Mick,

Just somthing to consider, how about storing all your images in a directory,
and just hold the path to the image in your productDatabase.
Makes maintenance of database and of images much simpler

ChrisM
 
F

fredg

Hi

I'd like to insert photographs into my productdatabase and i used OLE-object
as a datatype for the field i want to store Jpeg files. This doesn't work.
What is wrong with te picture?

Tx

Mick

Store the images in a folder.
Use a Text field in your table to store the path and/or picture name
"c:\foldername\Product.jpg"
or
"Product.jpg"

Use an Image control to display the picture:
ImageName.Picture = [FieldName]
or
ImageName.Picture = "c:\foldername\" & [FieldName]
 
M

Mick B

So, in a report or Form I insert a space for an image and then i change the
properties? or how does this work?
fredg said:
Hi

I'd like to insert photographs into my productdatabase and i used OLE-object
as a datatype for the field i want to store Jpeg files. This doesn't work.
What is wrong with te picture?

Tx

Mick

Store the images in a folder.
Use a Text field in your table to store the path and/or picture name
"c:\foldername\Product.jpg"
or
"Product.jpg"

Use an Image control to display the picture:
ImageName.Picture = [FieldName]
or
ImageName.Picture = "c:\foldername\" & [FieldName]
 
F

fredg

So, in a report or Form I insert a space for an image and then i change the
properties? or how does this work?
** snipped **
Are you asking how to get the Image control onto the report/form?

Add the Image control from the tool box. Add ANY picture to the
Picture property. Save the change. Then go back and delete the
Picture.

The Image will stick, and you can then either change the Picture
property directly or set the picture property using code.

If the Picture property is taken from a field in the table that is
included in the record source for the report/form, depending upon how
you have set the field up, if you have included the path and picture
name in the field, (i.e. "c:\foldername\PictureName.jpg") set the
Picture property to:
[FieldName].
If you only have the picture name in the field (and all the pictures
are stored in the same folder), then use, as the Picture property:
"c:\foldername\" & [FieldName]

You could, if the situation warrants, leave the picture property
blank, and use an event to set the property:
ImageName.Picture = "c:\folderName\" & [FieldName]

Which event depends on whether you are in a Form or a Report.
In a form, probably the form Current event.
In a Report, probably the Format event of whatever section the Image
is in.
 
M

Mick B

Fred,

Her's what i've done but I always get the message "can't open file [image]"
.. I'll give you the full story so maybe you can detect the problem better
then...

I use one table as a source for my report; tblCollection . Main Fields
are; [productID] and [Image](properties for this field are set to text and
i type the path of my picturefolder there eg.
"../site/collection/image1.jpeg"

In my report in include both the fields. My record source is tblCollection
and then I inserted, as you said, an Image control, with just a picture,
I change the picture property from "c/:documents and settings/andsoon.." to
(litterally) [Image] and
then when try to leave/close the property box I get this message "sorry,
can't open file [Image]".
Maybe interesting to know; I tried to change the settings in the data and
event area of the property-box but these tabs showed no possible actions to
take...

Do you know what the problem could be here? Or is it just me?
fredg said:
So, in a report or Form I insert a space for an image and then i change the
properties? or how does this work?
** snipped **
Are you asking how to get the Image control onto the report/form?

Add the Image control from the tool box. Add ANY picture to the
Picture property. Save the change. Then go back and delete the
Picture.

The Image will stick, and you can then either change the Picture
property directly or set the picture property using code.

If the Picture property is taken from a field in the table that is
included in the record source for the report/form, depending upon how
you have set the field up, if you have included the path and picture
name in the field, (i.e. "c:\foldername\PictureName.jpg") set the
Picture property to:
[FieldName].
If you only have the picture name in the field (and all the pictures
are stored in the same folder), then use, as the Picture property:
"c:\foldername\" & [FieldName]

You could, if the situation warrants, leave the picture property
blank, and use an event to set the property:
ImageName.Picture = "c:\folderName\" & [FieldName]

Which event depends on whether you are in a Form or a Report.
In a form, probably the form Current event.
In a Report, probably the Format event of whatever section the Image
is in.
 
F

fredg

Fred,

Her's what i've done but I always get the message "can't open file [image]"
. I'll give you the full story so maybe you can detect the problem better
then...

I use one table as a source for my report; tblCollection . Main Fields
are; [productID] and [Image](properties for this field are set to text and
i type the path of my picturefolder there eg.
"../site/collection/image1.jpeg"

In my report in include both the fields. My record source is tblCollection
and then I inserted, as you said, an Image control, with just a picture,
I change the picture property from "c/:documents and settings/andsoon.." to
(litterally) [Image] and
then when try to leave/close the property box I get this message "sorry,
can't open file [Image]".
Maybe interesting to know; I tried to change the settings in the data and
event area of the property-box but these tabs showed no possible actions to
take...

Do you know what the problem could be here? Or is it just me?
"fredg" <[email protected]> schreef in bericht
** snipped **

Set the actual Image Control's Picture property to (none).

Then use a Report format event to set the picture property.

For example, if the Image is to be displayed in the Detail section of
the report, place the following code in the Detail format event:

ImageName.Picture = [Image]

Change [ImageName] to whatever the actual name of the Image control
is.

Fred
Please only reply to this newsgroup.
I do not reply to personal email.
 
M

Mick B

I did this but now i4m not able to get out of the design view anymore...

this is exactly what ive done...

in the detail section i called the properties box; I went to the event tab
there i went to the space Format and i typed the folloowing:

[myPicture].picture = [Image]

given the fact that i named my image controll "myPicture" and that the field
name is "Image" of course
fredg said:
Fred,

Her's what i've done but I always get the message "can't open file [image]"
. I'll give you the full story so maybe you can detect the problem better
then...

I use one table as a source for my report; tblCollection . Main Fields
are; [productID] and [Image](properties for this field are set to text and
i type the path of my picturefolder there eg.
"../site/collection/image1.jpeg"

In my report in include both the fields. My record source is tblCollection
and then I inserted, as you said, an Image control, with just a picture,
I change the picture property from "c/:documents and settings/andsoon.." to
(litterally) [Image] and
then when try to leave/close the property box I get this message "sorry,
can't open file [Image]".
Maybe interesting to know; I tried to change the settings in the data and
event area of the property-box but these tabs showed no possible actions to
take...

Do you know what the problem could be here? Or is it just me?
"fredg" <[email protected]> schreef in bericht
** snipped **

Set the actual Image Control's Picture property to (none).

Then use a Report format event to set the picture property.

For example, if the Image is to be displayed in the Detail section of
the report, place the following code in the Detail format event:

ImageName.Picture = [Image]

Change [ImageName] to whatever the actual name of the Image control
is.

Fred
Please only reply to this newsgroup.
I do not reply to personal email.
 
F

fredg

I did this but now i4m not able to get out of the design view anymore...

this is exactly what ive done...

in the detail section i called the properties box; I went to the event tab
there i went to the space Format and i typed the folloowing:

[myPicture].picture = [Image]

given the fact that i named my image controll "myPicture" and that the field
name is "Image" of course
** snipped **
That's NOT how you write code.

On the Report Detail Format event line, write:
[Event Procedure]
Then click on the button with 3 dots that will appear.
The Code window will open with the cursor flashing between 2 already
existing lines.

Type:
[myPicture].picture = [Image]

between this 2 lines.
When done the Detail Format event should read like this:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
[myPicture].picture = [Image]
End If

Try it now.
 
M

Mick B

Now i get error message 2220; MS ACCES can't open file .... It seems like
there's no recognition of the path alltough i copied it as it is. By the
way, I thought i was already pretty good at access, but when there's code
involved i'm still wet behind the ears:).

Could it be that i first have to make a query where i select only the fields
that contain a path? Now i also include records where the [image] field is
null....


fredg said:
I did this but now i4m not able to get out of the design view anymore...

this is exactly what ive done...

in the detail section i called the properties box; I went to the event tab
there i went to the space Format and i typed the folloowing:

[myPicture].picture = [Image]

given the fact that i named my image controll "myPicture" and that the field
name is "Image" of course
fredg said:
On Thu, 01 Apr 2004 06:58:18 GMT, Mick B wrote:

Fred,
** snipped **
That's NOT how you write code.

On the Report Detail Format event line, write:
[Event Procedure]
Then click on the button with 3 dots that will appear.
The Code window will open with the cursor flashing between 2 already
existing lines.

Type:
[myPicture].picture = [Image]

between this 2 lines.
When done the Detail Format event should read like this:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
[myPicture].picture = [Image]
End If

Try it now.
 
F

fredg

Now i get error message 2220; MS ACCES can't open file .... It seems like
there's no recognition of the path alltough i copied it as it is. By the
way, I thought i was already pretty good at access, but when there's code
involved i'm still wet behind the ears:).

Could it be that i first have to make a query where i select only the fields
that contain a path? Now i also include records where the [image] field is
null....

fredg said:
I did this but now i4m not able to get out of the design view anymore...

this is exactly what ive done...

in the detail section i called the properties box; I went to the event tab
there i went to the space Format and i typed the folloowing:

[myPicture].picture = [Image]

given the fact that i named my image controll "myPicture" and that the field
name is "Image" of course
"fredg" <[email protected]> schreef in bericht
On Thu, 01 Apr 2004 06:58:18 GMT, Mick B wrote:

Fred,
** snipped **
That's NOT how you write code.

On the Report Detail Format event line, write:
[Event Procedure]
Then click on the button with 3 dots that will appear.
The Code window will open with the cursor flashing between 2 already
existing lines.

Type:
[myPicture].picture = [Image]

between this 2 lines.
When done the Detail Format event should read like this:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
[myPicture].picture = [Image]
End If

Try it now.

If IsNull([Image]) Then
Me![myPicture].Visible = False ' not show the previous picture
Else
[myPicture].picture = [Image]
Me![myPicture].Visible = True ' show the current picture
End If

If the above code doesn't work for you, change the code between the
first 2 lines to:

On Error GoTo Err_Handler
[myPicture].picture = [Image]

Exit_This_Sub:
Exit Sub
Err_Handler:
If err = 2220 or err = 2114 Then
Else
MsgBox "Error #: " & Err.number & " " & Err.Description
End If
Resume Exit_this_Sub
 
M

Mick B

Hi Fred,

With yhour first solution i still get error 2220 cant find file BUT at least
the path is shown in the message so i think i came closer to a cigar.....

Your second solution turned out on error msge; "Error#; 13 types do not
accord "(I don't know if 'Accord' is exactly the right word, but i use a
version in Dutch, so...)
fredg said:
Now i get error message 2220; MS ACCES can't open file .... It seems like
there's no recognition of the path alltough i copied it as it is. By the
way, I thought i was already pretty good at access, but when there's code
involved i'm still wet behind the ears:).

Could it be that i first have to make a query where i select only the fields
that contain a path? Now i also include records where the [image] field is
null....

fredg said:
On Thu, 01 Apr 2004 20:19:58 GMT, Mick B wrote:

I did this but now i4m not able to get out of the design view anymore...

this is exactly what ive done...

in the detail section i called the properties box; I went to the event tab
there i went to the space Format and i typed the folloowing:

[myPicture].picture = [Image]

given the fact that i named my image controll "myPicture" and that the field
name is "Image" of course
"fredg" <[email protected]> schreef in bericht
On Thu, 01 Apr 2004 06:58:18 GMT, Mick B wrote:

Fred,

** snipped **
That's NOT how you write code.

On the Report Detail Format event line, write:
[Event Procedure]
Then click on the button with 3 dots that will appear.
The Code window will open with the cursor flashing between 2 already
existing lines.

Type:
[myPicture].picture = [Image]

between this 2 lines.
When done the Detail Format event should read like this:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
[myPicture].picture = [Image]
End If

Try it now.

If IsNull([Image]) Then
Me![myPicture].Visible = False ' not show the previous picture
Else
[myPicture].picture = [Image]
Me![myPicture].Visible = True ' show the current picture
End If

If the above code doesn't work for you, change the code between the
first 2 lines to:

On Error GoTo Err_Handler
[myPicture].picture = [Image]

Exit_This_Sub:
Exit Sub
Err_Handler:
If err = 2220 or err = 2114 Then
Else
MsgBox "Error #: " & Err.number & " " & Err.Description
End If
Resume Exit_this_Sub
 
M

Mick B

Fred,

I found the problem; somehow I copied the pathname with the.jpeg extension,
but when I looked at the properties for these files I saw the extensions
were set at.jpg. Now it works out fantastic, even with your first idea!

I'm sorry to have bothered you so long, while the problem wasn't actually
code-related but merely a syntaxis-error...

Anyway, you've made a lot of things a lot cleare for me now.

Thanks a lot!

Mick
fredg said:
Now i get error message 2220; MS ACCES can't open file .... It seems like
there's no recognition of the path alltough i copied it as it is. By the
way, I thought i was already pretty good at access, but when there's code
involved i'm still wet behind the ears:).

Could it be that i first have to make a query where i select only the fields
that contain a path? Now i also include records where the [image] field is
null....

fredg said:
On Thu, 01 Apr 2004 20:19:58 GMT, Mick B wrote:

I did this but now i4m not able to get out of the design view anymore...

this is exactly what ive done...

in the detail section i called the properties box; I went to the event tab
there i went to the space Format and i typed the folloowing:

[myPicture].picture = [Image]

given the fact that i named my image controll "myPicture" and that the field
name is "Image" of course
"fredg" <[email protected]> schreef in bericht
On Thu, 01 Apr 2004 06:58:18 GMT, Mick B wrote:

Fred,

** snipped **
That's NOT how you write code.

On the Report Detail Format event line, write:
[Event Procedure]
Then click on the button with 3 dots that will appear.
The Code window will open with the cursor flashing between 2 already
existing lines.

Type:
[myPicture].picture = [Image]

between this 2 lines.
When done the Detail Format event should read like this:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
[myPicture].picture = [Image]
End If

Try it now.

If IsNull([Image]) Then
Me![myPicture].Visible = False ' not show the previous picture
Else
[myPicture].picture = [Image]
Me![myPicture].Visible = True ' show the current picture
End If

If the above code doesn't work for you, change the code between the
first 2 lines to:

On Error GoTo Err_Handler
[myPicture].picture = [Image]

Exit_This_Sub:
Exit Sub
Err_Handler:
If err = 2220 or err = 2114 Then
Else
MsgBox "Error #: " & Err.number & " " & Err.Description
End If
Resume Exit_this_Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top