Change a picture in a form based on record?

G

Guest

In Access I have a form with a subform. In the subform one field contains a
shoe style. Based on the orderline one selects in the subform, can a picture
on the form change to that style shoe? I am thinking that the picture needs
to be a field in a table and have a PK. And then in another table that holds
the shoe styles, I can add a field with the foreign key for the picture
table. I know in a query I can call the picture or record but how can I make
the field on the form a picture?
 
G

Guest

Arvin,

I imported your table, forms, and modules in my db. Your code is based on
having a couple of forms open to me able to call controls and forms Me! I may
be wrong as I am not real strong using code. I am definetely missing things
in the code I pasted together. Needless to say what I did does not work. The
following is what I did, maybe you could look at it and help me correct it?

Using your table I entered the location and info for my pics. Also using
your forms I was able to call my pics, so that part works. In my form I
pasted your Image control on my main form (frmViewOrders). In my subform
(subfrmOrderLines) I put the following code in the On Current and After
Update Event Proceedure:

Dim MyStr As String
MyStr = Right([subfrmOrderLine].[FinishedItemID], 10, 4)
Me.Parent.[ImageFrame].Picture = Me![FilePath] & Me![FileName]
Me.Parent.[txtPath] = Me![FilePath] & Me![FileName]

All of the names on your form I have made on my form that I think matter.
What do you think?
--
Thanks,

Dennis


Arvin Meyer said:
You can do it with an Image control. There's a sample database on my
website:

http://www.datastrat.com/Download/Picture2K.zip

When using a subform, you should put the image on the main form and call it
from the subform, the code will change to something like:

Me.Parent.ImageControlName.Picture = strPath
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
A

Arvin Meyer [MVP]

I'll try and post a sample this evening.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Don said:
Arvin,

I imported your table, forms, and modules in my db. Your code is based on
having a couple of forms open to me able to call controls and forms Me! I
may
be wrong as I am not real strong using code. I am definetely missing
things
in the code I pasted together. Needless to say what I did does not work.
The
following is what I did, maybe you could look at it and help me correct
it?

Using your table I entered the location and info for my pics. Also using
your forms I was able to call my pics, so that part works. In my form I
pasted your Image control on my main form (frmViewOrders). In my subform
(subfrmOrderLines) I put the following code in the On Current and After
Update Event Proceedure:

Dim MyStr As String
MyStr = Right([subfrmOrderLine].[FinishedItemID], 10, 4)
Me.Parent.[ImageFrame].Picture = Me![FilePath] & Me![FileName]
Me.Parent.[txtPath] = Me![FilePath] & Me![FileName]

All of the names on your form I have made on my form that I think matter.
What do you think?
--
Thanks,

Dennis
 
A

Arvin Meyer [MVP]

The sample is posted:

http://www.accessmvp.com/Arvin/ImageSample.zip
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Arvin Meyer said:
I'll try and post a sample this evening.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Don said:
Arvin,

I imported your table, forms, and modules in my db. Your code is based on
having a couple of forms open to me able to call controls and forms Me! I
may
be wrong as I am not real strong using code. I am definetely missing
things
in the code I pasted together. Needless to say what I did does not work.
The
following is what I did, maybe you could look at it and help me correct
it?

Using your table I entered the location and info for my pics. Also using
your forms I was able to call my pics, so that part works. In my form I
pasted your Image control on my main form (frmViewOrders). In my subform
(subfrmOrderLines) I put the following code in the On Current and After
Update Event Proceedure:

Dim MyStr As String
MyStr = Right([subfrmOrderLine].[FinishedItemID], 10, 4)
Me.Parent.[ImageFrame].Picture = Me![FilePath] & Me![FileName]
Me.Parent.[txtPath] = Me![FilePath] & Me![FileName]

All of the names on your form I have made on my form that I think matter.
What do you think?
--
Thanks,

Dennis


Arvin Meyer said:
You can do it with an Image control. There's a sample database on my
website:

http://www.datastrat.com/Download/Picture2K.zip

When using a subform, you should put the image on the main form and call
it
from the subform, the code will change to something like:

Me.Parent.ImageControlName.Picture = strPath
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

In Access I have a form with a subform. In the subform one field
contains
a
shoe style. Based on the orderline one selects in the subform, can a
picture
on the form change to that style shoe? I am thinking that the picture
needs
to be a field in a table and have a PK. And then in another table that
holds
the shoe styles, I can add a field with the foreign key for the
picture
table. I know in a query I can call the picture or record but how can
I
make
the field on the form a picture?
 
G

Guest

Thanks Arvin I think I have it.

One more question is how can I suppress the message that pops up saying
Loading C:\pic\shoe.jpg?
--
Thanks,

Dennis


Arvin Meyer said:
The sample is posted:

http://www.accessmvp.com/Arvin/ImageSample.zip
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Arvin Meyer said:
I'll try and post a sample this evening.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Don said:
Arvin,

I imported your table, forms, and modules in my db. Your code is based on
having a couple of forms open to me able to call controls and forms Me! I
may
be wrong as I am not real strong using code. I am definetely missing
things
in the code I pasted together. Needless to say what I did does not work.
The
following is what I did, maybe you could look at it and help me correct
it?

Using your table I entered the location and info for my pics. Also using
your forms I was able to call my pics, so that part works. In my form I
pasted your Image control on my main form (frmViewOrders). In my subform
(subfrmOrderLines) I put the following code in the On Current and After
Update Event Proceedure:

Dim MyStr As String
MyStr = Right([subfrmOrderLine].[FinishedItemID], 10, 4)
Me.Parent.[ImageFrame].Picture = Me![FilePath] & Me![FileName]
Me.Parent.[txtPath] = Me![FilePath] & Me![FileName]

All of the names on your form I have made on my form that I think matter.
What do you think?
--
Thanks,

Dennis


:

You can do it with an Image control. There's a sample database on my
website:

http://www.datastrat.com/Download/Picture2K.zip

When using a subform, you should put the image on the main form and call
it
from the subform, the code will change to something like:

Me.Parent.ImageControlName.Picture = strPath
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

In Access I have a form with a subform. In the subform one field
contains
a
shoe style. Based on the orderline one selects in the subform, can a
picture
on the form change to that style shoe? I am thinking that the picture
needs
to be a field in a table and have a PK. And then in another table that
holds
the shoe styles, I can add a field with the foreign key for the
picture
table. I know in a query I can call the picture or record but how can
I
make
the field on the form a picture?
 
A

Arvin Meyer [MVP]

Try this:

http://www.mvps.org/access/api/api0038.htm
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Don said:
Thanks Arvin I think I have it.

One more question is how can I suppress the message that pops up saying
Loading C:\pic\shoe.jpg?
--
Thanks,

Dennis


Arvin Meyer said:
The sample is posted:

http://www.accessmvp.com/Arvin/ImageSample.zip
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Arvin Meyer said:
I'll try and post a sample this evening.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Arvin,

I imported your table, forms, and modules in my db. Your code is based
on
having a couple of forms open to me able to call controls and forms
Me! I
may
be wrong as I am not real strong using code. I am definetely missing
things
in the code I pasted together. Needless to say what I did does not
work.
The
following is what I did, maybe you could look at it and help me
correct
it?

Using your table I entered the location and info for my pics. Also
using
your forms I was able to call my pics, so that part works. In my form
I
pasted your Image control on my main form (frmViewOrders). In my
subform
(subfrmOrderLines) I put the following code in the On Current and
After
Update Event Proceedure:

Dim MyStr As String
MyStr = Right([subfrmOrderLine].[FinishedItemID], 10, 4)
Me.Parent.[ImageFrame].Picture = Me![FilePath] & Me![FileName]
Me.Parent.[txtPath] = Me![FilePath] & Me![FileName]

All of the names on your form I have made on my form that I think
matter.
What do you think?
--
Thanks,

Dennis


:

You can do it with an Image control. There's a sample database on my
website:

http://www.datastrat.com/Download/Picture2K.zip

When using a subform, you should put the image on the main form and
call
it
from the subform, the code will change to something like:

Me.Parent.ImageControlName.Picture = strPath
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

In Access I have a form with a subform. In the subform one field
contains
a
shoe style. Based on the orderline one selects in the subform, can
a
picture
on the form change to that style shoe? I am thinking that the
picture
needs
to be a field in a table and have a PK. And then in another table
that
holds
the shoe styles, I can add a field with the foreign key for the
picture
table. I know in a query I can call the picture or record but how
can
I
make
the field on the form a picture?
 
G

Guest

Arvin,

Thank you for your help I was able to have the correct image called for each
record and was able to supress the image loading if it was already called.

Thanks,

Dennis


Arvin Meyer said:
Try this:

http://www.mvps.org/access/api/api0038.htm
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Don said:
Thanks Arvin I think I have it.

One more question is how can I suppress the message that pops up saying
Loading C:\pic\shoe.jpg?
--
Thanks,

Dennis


Arvin Meyer said:
The sample is posted:

http://www.accessmvp.com/Arvin/ImageSample.zip
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

I'll try and post a sample this evening.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Arvin,

I imported your table, forms, and modules in my db. Your code is based
on
having a couple of forms open to me able to call controls and forms
Me! I
may
be wrong as I am not real strong using code. I am definetely missing
things
in the code I pasted together. Needless to say what I did does not
work.
The
following is what I did, maybe you could look at it and help me
correct
it?

Using your table I entered the location and info for my pics. Also
using
your forms I was able to call my pics, so that part works. In my form
I
pasted your Image control on my main form (frmViewOrders). In my
subform
(subfrmOrderLines) I put the following code in the On Current and
After
Update Event Proceedure:

Dim MyStr As String
MyStr = Right([subfrmOrderLine].[FinishedItemID], 10, 4)
Me.Parent.[ImageFrame].Picture = Me![FilePath] & Me![FileName]
Me.Parent.[txtPath] = Me![FilePath] & Me![FileName]

All of the names on your form I have made on my form that I think
matter.
What do you think?
--
Thanks,

Dennis


:

You can do it with an Image control. There's a sample database on my
website:

http://www.datastrat.com/Download/Picture2K.zip

When using a subform, you should put the image on the main form and
call
it
from the subform, the code will change to something like:

Me.Parent.ImageControlName.Picture = strPath
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

In Access I have a form with a subform. In the subform one field
contains
a
shoe style. Based on the orderline one selects in the subform, can
a
picture
on the form change to that style shoe? I am thinking that the
picture
needs
to be a field in a table and have a PK. And then in another table
that
holds
the shoe styles, I can add a field with the foreign key for the
picture
table. I know in a query I can call the picture or record but how
can
I
make
the field on the form a picture?
 

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