Access Form Field filepath to external picture code

E

Elleyne

We have an Access Form that in one cell has a picture code:
PwrNumb (field name): 123456789 (name of picture)

on another part of the form we need to display the file path to the picture.

In order to avoid typing mistakes, is there a macro, query, or other command
that we can create to automatically type in the file path, when we type in
the name of the picture into the textbox of the fieldname (PwrNumb) of
123456789 which is a changing number?

PWRNumb 123456789
FilePathName c:\Users\Elleyne\MyDocuments\Pictures\123456789.
jpg

We have many pictures to display, so we are thinking of creating a
command/macro etc. to automatically type in the file path as the picture name
changes. Is that possible? If yes, what would the command look like?

Thank you so much for your assistance.

Elleyne
 
A

Allen Browne

What version of Access is this?

If 2007, you can set put an Image control on your form, and set its Control
Source to:
=[txtPath] & [txtFile] & ".jpg"
assuming you have 2 controls named txtPath and txtFile that contain the
right information (including the trailing slash on the path.)

In previous versions, the Image control doesn't have a Control Source
property, so you have to set its Picture property in the Current Event of
the form, and the AfterUpdate event of the controls it depends on. Also,
this works for form view only (not Continuous view.)
 
E

Elleyne via AccessMonster.com

Thank you and yes we have Access 2007.

So you mean that we need to create an additional two controls that have the
txtPath and txtFile info in it. They can be hidden,of course.

I'll try it out and get back with you.

Thanks again.

Allen said:
What version of Access is this?

If 2007, you can set put an Image control on your form, and set its Control
Source to:
=[txtPath] & [txtFile] & ".jpg"
assuming you have 2 controls named txtPath and txtFile that contain the
right information (including the trailing slash on the path.)

In previous versions, the Image control doesn't have a Control Source
property, so you have to set its Picture property in the Current Event of
the form, and the AfterUpdate event of the controls it depends on. Also,
this works for form view only (not Continuous view.)
We have an Access Form that in one cell has a picture code:
PwrNumb (field name): 123456789 (name of picture)
[quoted text clipped - 21 lines]
 
A

Allen Browne

It's not essential to have the path and file name in 2 separate controls:
you just need some way to refer to the fully qualified file name in the
ControlSource of the Image control, including leaving it blank if there is
no picture for that record.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.


Elleyne via AccessMonster.com said:
Thank you and yes we have Access 2007.

So you mean that we need to create an additional two controls that have
the
txtPath and txtFile info in it. They can be hidden,of course.

I'll try it out and get back with you.

Thanks again.

Allen said:
What version of Access is this?

If 2007, you can set put an Image control on your form, and set its
Control
Source to:
=[txtPath] & [txtFile] & ".jpg"
assuming you have 2 controls named txtPath and txtFile that contain the
right information (including the trailing slash on the path.)

In previous versions, the Image control doesn't have a Control Source
property, so you have to set its Picture property in the Current Event of
the form, and the AfterUpdate event of the controls it depends on. Also,
this works for form view only (not Continuous view.)
We have an Access Form that in one cell has a picture code:
PwrNumb (field name): 123456789 (name of picture)
[quoted text clipped - 21 lines]
 

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