Coding a path to an image to fill a placeholder

B

Bill Foley

Hey Gang,

Access 2003

I have a form with an image holder that is filled with a JPG from a folder.
I originally had it hardcoded to that path plus the filename plus ".jpg".
It worked fine, but then I needed to break all images (over 1500 of them)
into separate folders. I added a field to the table representing these new
folders and broke each set of images into their respective folder. I am now
trying to hardcode part of the path and variable the rest and it is not
working.

This worked before (when all images in the same folder):

[Image19].Picture = "D:\mypath\myfolders\" & [FileName].Value & ".jpg"

Now the last folder in this new path is based on the field "VolumeNumber".
I have tried the following (and variations) to no avail:

[Image19].Picture = "D:\mypath\myfolders\" & [VolumeNumber].Value & "\" &
[FileName].Value & ".jpg"

I am sure I am missing the obvious, but I AM missing it so I need
assistance.

TIA!
 
T

tina

did you try putting a Break on your code and stepping through it so you can
examine the value returned by VolumeNumber.Value? or you can comment out the
line of code, and add a Debug.Print line below it, as

Debug.Print "D:\mypath\myfolders\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

run the code from the form as usual, then open the Immediate window in the
VB Editor, and examine the printed string to see what may be incorrect.

hth
 
B

Bill Foley

I tried it and the correct path is showing up for each image. I have error
checking in the code to show a "fake image" if it can't find the correct
image. The fake image is showing up on the form for each record but when I
go back into the Immediate Window the correct path is showing up for each
image. The darndest thing I have ever seen!

Any other ideas? Would it be worth posting the entire "Form_Current" code?

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
tina said:
did you try putting a Break on your code and stepping through it so you
can
examine the value returned by VolumeNumber.Value? or you can comment out
the
line of code, and add a Debug.Print line below it, as

Debug.Print "D:\mypath\myfolders\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

run the code from the form as usual, then open the Immediate window in the
VB Editor, and examine the printed string to see what may be incorrect.

hth


Bill Foley said:
Hey Gang,

Access 2003

I have a form with an image holder that is filled with a JPG from a folder.
I originally had it hardcoded to that path plus the filename plus ".jpg".
It worked fine, but then I needed to break all images (over 1500 of them)
into separate folders. I added a field to the table representing these new
folders and broke each set of images into their respective folder. I am now
trying to hardcode part of the path and variable the rest and it is not
working.

This worked before (when all images in the same folder):

[Image19].Picture = "D:\mypath\myfolders\" & [FileName].Value & ".jpg"

Now the last folder in this new path is based on the field
"VolumeNumber".
I have tried the following (and variations) to no avail:

[Image19].Picture = "D:\mypath\myfolders\" & [VolumeNumber].Value & "\" &
[FileName].Value & ".jpg"

I am sure I am missing the obvious, but I AM missing it so I need
assistance.

TIA!
 
T

tina

hmm, well, i agree with you that it's strange. you could post the entire
procedure; maybe one of us will spot something that's causing the problem.

hth


Bill Foley said:
I tried it and the correct path is showing up for each image. I have error
checking in the code to show a "fake image" if it can't find the correct
image. The fake image is showing up on the form for each record but when I
go back into the Immediate Window the correct path is showing up for each
image. The darndest thing I have ever seen!

Any other ideas? Would it be worth posting the entire "Form_Current" code?

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
tina said:
did you try putting a Break on your code and stepping through it so you
can
examine the value returned by VolumeNumber.Value? or you can comment out
the
line of code, and add a Debug.Print line below it, as

Debug.Print "D:\mypath\myfolders\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

run the code from the form as usual, then open the Immediate window in the
VB Editor, and examine the printed string to see what may be incorrect.

hth


Bill Foley said:
Hey Gang,

Access 2003

I have a form with an image holder that is filled with a JPG from a folder.
I originally had it hardcoded to that path plus the filename plus ".jpg".
It worked fine, but then I needed to break all images (over 1500 of them)
into separate folders. I added a field to the table representing these new
folders and broke each set of images into their respective folder. I
am
now
trying to hardcode part of the path and variable the rest and it is not
working.

This worked before (when all images in the same folder):

[Image19].Picture = "D:\mypath\myfolders\" & [FileName].Value & ".jpg"

Now the last folder in this new path is based on the field
"VolumeNumber".
I have tried the following (and variations) to no avail:

[Image19].Picture = "D:\mypath\myfolders\" & [VolumeNumber].Value & "\" &
[FileName].Value & ".jpg"

I am sure I am missing the obvious, but I AM missing it so I need
assistance.

TIA!
 
B

Bill Foley

I just opened the form, went into the code to see the Immediate Window (see
below) and the path to the image is there, but the image itself did not show
up.

Here is the complete code (with the previous stuff added to check it out).
The line that is commented out used to work before I moved the images into
the individual folders (actually I copied them so the images show if I
uncomment that line and comment out the new way).

Private Sub Form_Current()
On Error GoTo ErrorHandler

'This part I added to see the results in the Immediate Window (see below)
Debug.Print "D:\ptt\Calhoun\New STM Stuff\New Material\New Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

'This is the new way using the subfolder field [VolumeNumber]
[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

'This is the way I had it initially and still works (currently commented
out)
'[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" & [FileName].Value & ".jpg"

GoTo Done

ErrorHandler:
[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\noimage.jpg"

Done:
End Sub

Immediate Window (for the first image) on the form shows correctly:

D:\ptt\Calhoun\New STM Stuff\New Material\New Graphics\VOL_02\spanela.jpg

However, the "noimage.jpg" file continues to show and none of the real
images show. Any help (probably so obvious I'll slap myself) would be
appreciated.

TIA!

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
tina said:
hmm, well, i agree with you that it's strange. you could post the entire
procedure; maybe one of us will spot something that's causing the problem.

hth


Bill Foley said:
I tried it and the correct path is showing up for each image. I have error
checking in the code to show a "fake image" if it can't find the correct
image. The fake image is showing up on the form for each record but when I
go back into the Immediate Window the correct path is showing up for each
image. The darndest thing I have ever seen!

Any other ideas? Would it be worth posting the entire "Form_Current" code?

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
tina said:
did you try putting a Break on your code and stepping through it so you
can
examine the value returned by VolumeNumber.Value? or you can comment
out
the
line of code, and add a Debug.Print line below it, as

Debug.Print "D:\mypath\myfolders\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

run the code from the form as usual, then open the Immediate window in the
VB Editor, and examine the printed string to see what may be incorrect.

hth


"Bill Foley" <pttincatitexasdotnet> wrote in message
Hey Gang,

Access 2003

I have a form with an image holder that is filled with a JPG from a
folder.
I originally had it hardcoded to that path plus the filename plus ".jpg".
It worked fine, but then I needed to break all images (over 1500 of them)
into separate folders. I added a field to the table representing
these
new
folders and broke each set of images into their respective folder. I am
now
trying to hardcode part of the path and variable the rest and it is
not
working.

This worked before (when all images in the same folder):

[Image19].Picture = "D:\mypath\myfolders\" & [FileName].Value & ".jpg"

Now the last folder in this new path is based on the field
"VolumeNumber".
I have tried the following (and variations) to no avail:

[Image19].Picture = "D:\mypath\myfolders\" & [VolumeNumber].Value &
"\" &
[FileName].Value & ".jpg"

I am sure I am missing the obvious, but I AM missing it so I need
assistance.

TIA!
 
R

Rob Parker

PMFJI,

I don't see anything obviously wrong, so here's a suggestion which may help
to find the problem:

Your error handler is displaying the default "noimage" image. Try
commenting that out, and replace it with code to display the error code and
message, so you can find what's failing. It may be that the error is coming
from something external - like a typo in the filename, or no access
permission on the new folder, or ...

HTH,

Rob


Bill Foley said:
I just opened the form, went into the code to see the Immediate Window (see
below) and the path to the image is there, but the image itself did not
show up.

Here is the complete code (with the previous stuff added to check it out).
The line that is commented out used to work before I moved the images into
the individual folders (actually I copied them so the images show if I
uncomment that line and comment out the new way).

Private Sub Form_Current()
On Error GoTo ErrorHandler

'This part I added to see the results in the Immediate Window (see below)
Debug.Print "D:\ptt\Calhoun\New STM Stuff\New Material\New Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

'This is the new way using the subfolder field [VolumeNumber]
[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

'This is the way I had it initially and still works (currently commented
out)
'[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" & [FileName].Value & ".jpg"

GoTo Done

ErrorHandler:
[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\noimage.jpg"

Done:
End Sub

Immediate Window (for the first image) on the form shows correctly:

D:\ptt\Calhoun\New STM Stuff\New Material\New Graphics\VOL_02\spanela.jpg

However, the "noimage.jpg" file continues to show and none of the real
images show. Any help (probably so obvious I'll slap myself) would be
appreciated.

TIA!

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
tina said:
hmm, well, i agree with you that it's strange. you could post the entire
procedure; maybe one of us will spot something that's causing the
problem.

hth


Bill Foley said:
I tried it and the correct path is showing up for each image. I have error
checking in the code to show a "fake image" if it can't find the correct
image. The fake image is showing up on the form for each record but
when I
go back into the Immediate Window the correct path is showing up for
each
image. The darndest thing I have ever seen!

Any other ideas? Would it be worth posting the entire "Form_Current" code?

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
did you try putting a Break on your code and stepping through it so
you
can
examine the value returned by VolumeNumber.Value? or you can comment
out
the
line of code, and add a Debug.Print line below it, as

Debug.Print "D:\mypath\myfolders\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

run the code from the form as usual, then open the Immediate window in the
VB Editor, and examine the printed string to see what may be
incorrect.

hth


"Bill Foley" <pttincatitexasdotnet> wrote in message
Hey Gang,

Access 2003

I have a form with an image holder that is filled with a JPG from a
folder.
I originally had it hardcoded to that path plus the filename plus ".jpg".
It worked fine, but then I needed to break all images (over 1500 of them)
into separate folders. I added a field to the table representing
these
new
folders and broke each set of images into their respective folder. I am
now
trying to hardcode part of the path and variable the rest and it is
not
working.

This worked before (when all images in the same folder):

[Image19].Picture = "D:\mypath\myfolders\" & [FileName].Value &
".jpg"

Now the last folder in this new path is based on the field
"VolumeNumber".
I have tried the following (and variations) to no avail:

[Image19].Picture = "D:\mypath\myfolders\" & [VolumeNumber].Value &
"\" &
[FileName].Value & ".jpg"

I am sure I am missing the obvious, but I AM missing it so I need
assistance.

TIA!
 
B

Bill Foley

When I open the form and first image tries to appear, the error message
says:

"Error number 2220: FCS Graphics can't open the file 'D:\PTT\calhoun\New STM
Stuff\New Material\VOL_02\spanela.jpg'.

There aren't any permissions associated with the new folders. There were
merely added subfolders. Is there some sort of path length problem that I
just happened to fall over? Sorry, but I'm grabbing at straws. This makes
no sense to me.

Thanks again for your help!

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
Rob Parker said:
PMFJI,

I don't see anything obviously wrong, so here's a suggestion which may
help to find the problem:

Your error handler is displaying the default "noimage" image. Try
commenting that out, and replace it with code to display the error code
and message, so you can find what's failing. It may be that the error is
coming from something external - like a typo in the filename, or no access
permission on the new folder, or ...

HTH,

Rob


Bill Foley said:
I just opened the form, went into the code to see the Immediate Window
(see below) and the path to the image is there, but the image itself did
not show up.

Here is the complete code (with the previous stuff added to check it
out). The line that is commented out used to work before I moved the
images into the individual folders (actually I copied them so the images
show if I uncomment that line and comment out the new way).

Private Sub Form_Current()
On Error GoTo ErrorHandler

'This part I added to see the results in the Immediate Window (see below)
Debug.Print "D:\ptt\Calhoun\New STM Stuff\New Material\New Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

'This is the new way using the subfolder field [VolumeNumber]
[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

'This is the way I had it initially and still works (currently commented
out)
'[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" & [FileName].Value & ".jpg"

GoTo Done

ErrorHandler:
[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\noimage.jpg"

Done:
End Sub

Immediate Window (for the first image) on the form shows correctly:

D:\ptt\Calhoun\New STM Stuff\New Material\New Graphics\VOL_02\spanela.jpg

However, the "noimage.jpg" file continues to show and none of the real
images show. Any help (probably so obvious I'll slap myself) would be
appreciated.

TIA!

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
tina said:
hmm, well, i agree with you that it's strange. you could post the entire
procedure; maybe one of us will spot something that's causing the
problem.

hth


"Bill Foley" <pttincatitexasdotnet> wrote in message
I tried it and the correct path is showing up for each image. I have
error
checking in the code to show a "fake image" if it can't find the
correct
image. The fake image is showing up on the form for each record but
when
I
go back into the Immediate Window the correct path is showing up for
each
image. The darndest thing I have ever seen!

Any other ideas? Would it be worth posting the entire "Form_Current"
code?

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
did you try putting a Break on your code and stepping through it so
you
can
examine the value returned by VolumeNumber.Value? or you can comment
out
the
line of code, and add a Debug.Print line below it, as

Debug.Print "D:\mypath\myfolders\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

run the code from the form as usual, then open the Immediate window
in
the
VB Editor, and examine the printed string to see what may be
incorrect.

hth


"Bill Foley" <pttincatitexasdotnet> wrote in message
Hey Gang,

Access 2003

I have a form with an image holder that is filled with a JPG from a
folder.
I originally had it hardcoded to that path plus the filename plus
".jpg".
It worked fine, but then I needed to break all images (over 1500 of
them)
into separate folders. I added a field to the table representing
these
new
folders and broke each set of images into their respective folder.
I
am
now
trying to hardcode part of the path and variable the rest and it is
not
working.

This worked before (when all images in the same folder):

[Image19].Picture = "D:\mypath\myfolders\" & [FileName].Value &
".jpg"

Now the last folder in this new path is based on the field
"VolumeNumber".
I have tried the following (and variations) to no avail:

[Image19].Picture = "D:\mypath\myfolders\" & [VolumeNumber].Value &
"\"
&
[FileName].Value & ".jpg"

I am sure I am missing the obvious, but I AM missing it so I need
assistance.

TIA!
 
R

Rob Parker

Bill,

The error message is telling you that the file cannot be opened; I think
it's probably saying 'FCS Graphics ...' because that's the default
association you have set on your system for .jpg files. What happens if you
try to open that file directly (eg. by double-clicking it in Windows
Explorer)?

Rob

Bill Foley said:
When I open the form and first image tries to appear, the error message
says:

"Error number 2220: FCS Graphics can't open the file 'D:\PTT\calhoun\New
STM Stuff\New Material\VOL_02\spanela.jpg'.

There aren't any permissions associated with the new folders. There were
merely added subfolders. Is there some sort of path length problem that I
just happened to fall over? Sorry, but I'm grabbing at straws. This
makes no sense to me.

Thanks again for your help!

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
Rob Parker said:
PMFJI,

I don't see anything obviously wrong, so here's a suggestion which may
help to find the problem:

Your error handler is displaying the default "noimage" image. Try
commenting that out, and replace it with code to display the error code
and message, so you can find what's failing. It may be that the error is
coming from something external - like a typo in the filename, or no
access permission on the new folder, or ...

HTH,

Rob


Bill Foley said:
I just opened the form, went into the code to see the Immediate Window
(see below) and the path to the image is there, but the image itself did
not show up.

Here is the complete code (with the previous stuff added to check it
out). The line that is commented out used to work before I moved the
images into the individual folders (actually I copied them so the images
show if I uncomment that line and comment out the new way).

Private Sub Form_Current()
On Error GoTo ErrorHandler

'This part I added to see the results in the Immediate Window (see
below)
Debug.Print "D:\ptt\Calhoun\New STM Stuff\New Material\New Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

'This is the new way using the subfolder field [VolumeNumber]
[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

'This is the way I had it initially and still works (currently commented
out)
'[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" & [FileName].Value & ".jpg"

GoTo Done

ErrorHandler:
[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\noimage.jpg"

Done:
End Sub

Immediate Window (for the first image) on the form shows correctly:

D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\VOL_02\spanela.jpg

However, the "noimage.jpg" file continues to show and none of the real
images show. Any help (probably so obvious I'll slap myself) would be
appreciated.

TIA!

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
hmm, well, i agree with you that it's strange. you could post the
entire
procedure; maybe one of us will spot something that's causing the
problem.

hth


"Bill Foley" <pttincatitexasdotnet> wrote in message
I tried it and the correct path is showing up for each image. I have
error
checking in the code to show a "fake image" if it can't find the
correct
image. The fake image is showing up on the form for each record but
when
I
go back into the Immediate Window the correct path is showing up for
each
image. The darndest thing I have ever seen!

Any other ideas? Would it be worth posting the entire "Form_Current"
code?

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
did you try putting a Break on your code and stepping through it so
you
can
examine the value returned by VolumeNumber.Value? or you can comment
out
the
line of code, and add a Debug.Print line below it, as

Debug.Print "D:\mypath\myfolders\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

run the code from the form as usual, then open the Immediate window
in
the
VB Editor, and examine the printed string to see what may be
incorrect.

hth


"Bill Foley" <pttincatitexasdotnet> wrote in message
Hey Gang,

Access 2003

I have a form with an image holder that is filled with a JPG from a
folder.
I originally had it hardcoded to that path plus the filename plus
".jpg".
It worked fine, but then I needed to break all images (over 1500 of
them)
into separate folders. I added a field to the table representing
these
new
folders and broke each set of images into their respective folder.
I
am
now
trying to hardcode part of the path and variable the rest and it is
not
working.

This worked before (when all images in the same folder):

[Image19].Picture = "D:\mypath\myfolders\" & [FileName].Value &
".jpg"

Now the last folder in this new path is based on the field
"VolumeNumber".
I have tried the following (and variations) to no avail:

[Image19].Picture = "D:\mypath\myfolders\" & [VolumeNumber].Value &
"\"
&
[FileName].Value & ".jpg"

I am sure I am missing the obvious, but I AM missing it so I need
assistance.

TIA!
 
B

Bill Foley

FCS Graphics is the name of the form this code is run on. They always open
fine in Explorer. Matter of fact the previous method (see below) worked
before I broke them out into separate folders.

[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" & [FileName].Value & ".jpg"

It is only when I add the additional field as a variable (same name as the
subfolder) that it stops working. Funny thing is (as you have probably read
in this thread) is that the Immediate Window shows each correct file path
and name when I run the Debug (see below), but the form will not display
them.

Debug.Print "D:\ptt\Calhoun\New STM Stuff\New Material\New Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

For the life of me, I can't figure it out.

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
Rob Parker said:
Bill,

The error message is telling you that the file cannot be opened; I think
it's probably saying 'FCS Graphics ...' because that's the default
association you have set on your system for .jpg files. What happens if
you try to open that file directly (eg. by double-clicking it in Windows
Explorer)?

Rob

Bill Foley said:
When I open the form and first image tries to appear, the error message
says:

"Error number 2220: FCS Graphics can't open the file 'D:\PTT\calhoun\New
STM Stuff\New Material\VOL_02\spanela.jpg'.

There aren't any permissions associated with the new folders. There were
merely added subfolders. Is there some sort of path length problem that
I just happened to fall over? Sorry, but I'm grabbing at straws. This
makes no sense to me.

Thanks again for your help!

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
Rob Parker said:
PMFJI,

I don't see anything obviously wrong, so here's a suggestion which may
help to find the problem:

Your error handler is displaying the default "noimage" image. Try
commenting that out, and replace it with code to display the error code
and message, so you can find what's failing. It may be that the error
is coming from something external - like a typo in the filename, or no
access permission on the new folder, or ...

HTH,

Rob


"Bill Foley" <pttincatitexasdotnet> wrote in message
I just opened the form, went into the code to see the Immediate Window
(see below) and the path to the image is there, but the image itself did
not show up.

Here is the complete code (with the previous stuff added to check it
out). The line that is commented out used to work before I moved the
images into the individual folders (actually I copied them so the
images show if I uncomment that line and comment out the new way).

Private Sub Form_Current()
On Error GoTo ErrorHandler

'This part I added to see the results in the Immediate Window (see
below)
Debug.Print "D:\ptt\Calhoun\New STM Stuff\New Material\New Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

'This is the new way using the subfolder field [VolumeNumber]
[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

'This is the way I had it initially and still works (currently
commented out)
'[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" & [FileName].Value & ".jpg"

GoTo Done

ErrorHandler:
[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\noimage.jpg"

Done:
End Sub

Immediate Window (for the first image) on the form shows correctly:

D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\VOL_02\spanela.jpg

However, the "noimage.jpg" file continues to show and none of the real
images show. Any help (probably so obvious I'll slap myself) would be
appreciated.

TIA!

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
hmm, well, i agree with you that it's strange. you could post the
entire
procedure; maybe one of us will spot something that's causing the
problem.

hth


"Bill Foley" <pttincatitexasdotnet> wrote in message
I tried it and the correct path is showing up for each image. I have
error
checking in the code to show a "fake image" if it can't find the
correct
image. The fake image is showing up on the form for each record but
when
I
go back into the Immediate Window the correct path is showing up for
each
image. The darndest thing I have ever seen!

Any other ideas? Would it be worth posting the entire "Form_Current"
code?

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
did you try putting a Break on your code and stepping through it so
you
can
examine the value returned by VolumeNumber.Value? or you can
comment out
the
line of code, and add a Debug.Print line below it, as

Debug.Print "D:\mypath\myfolders\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

run the code from the form as usual, then open the Immediate window
in
the
VB Editor, and examine the printed string to see what may be
incorrect.

hth


"Bill Foley" <pttincatitexasdotnet> wrote in message
Hey Gang,

Access 2003

I have a form with an image holder that is filled with a JPG from
a
folder.
I originally had it hardcoded to that path plus the filename plus
".jpg".
It worked fine, but then I needed to break all images (over 1500
of
them)
into separate folders. I added a field to the table representing
these
new
folders and broke each set of images into their respective folder.
I
am
now
trying to hardcode part of the path and variable the rest and it
is not
working.

This worked before (when all images in the same folder):

[Image19].Picture = "D:\mypath\myfolders\" & [FileName].Value &
".jpg"

Now the last folder in this new path is based on the field
"VolumeNumber".
I have tried the following (and variations) to no avail:

[Image19].Picture = "D:\mypath\myfolders\" & [VolumeNumber].Value
& "\"
&
[FileName].Value & ".jpg"

I am sure I am missing the obvious, but I AM missing it so I need
assistance.

TIA!
 
R

Rob Parker

Hi again Bill,

Well, since the file opens OK in Windows Explorer, I'm rather puzzled also.

Could it perchance be a "non-obvious" typo - perhaps a O and 0 confused,
either in the Access code (or table entry), or in the folder name? You can
probably check this by cutting directly from the path string printed to the
Immediate window via your debug.print statement, and pasting into the
address bar of your browser; does the image file open, or does that give an
error?

Rob

Bill Foley said:
FCS Graphics is the name of the form this code is run on. They always
open fine in Explorer. Matter of fact the previous method (see below)
worked before I broke them out into separate folders.

[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" & [FileName].Value & ".jpg"

It is only when I add the additional field as a variable (same name as the
subfolder) that it stops working. Funny thing is (as you have probably
read in this thread) is that the Immediate Window shows each correct file
path and name when I run the Debug (see below), but the form will not
display them.

Debug.Print "D:\ptt\Calhoun\New STM Stuff\New Material\New Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

For the life of me, I can't figure it out.

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
Rob Parker said:
Bill,

The error message is telling you that the file cannot be opened; I think
it's probably saying 'FCS Graphics ...' because that's the default
association you have set on your system for .jpg files. What happens if
you try to open that file directly (eg. by double-clicking it in Windows
Explorer)?

Rob

Bill Foley said:
When I open the form and first image tries to appear, the error message
says:

"Error number 2220: FCS Graphics can't open the file 'D:\PTT\calhoun\New
STM Stuff\New Material\VOL_02\spanela.jpg'.

There aren't any permissions associated with the new folders. There
were merely added subfolders. Is there some sort of path length problem
that I just happened to fall over? Sorry, but I'm grabbing at straws.
This makes no sense to me.

Thanks again for your help!

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
message PMFJI,

I don't see anything obviously wrong, so here's a suggestion which may
help to find the problem:

Your error handler is displaying the default "noimage" image. Try
commenting that out, and replace it with code to display the error code
and message, so you can find what's failing. It may be that the error
is coming from something external - like a typo in the filename, or no
access permission on the new folder, or ...

HTH,

Rob


"Bill Foley" <pttincatitexasdotnet> wrote in message
I just opened the form, went into the code to see the Immediate Window
(see below) and the path to the image is there, but the image itself
did not show up.

Here is the complete code (with the previous stuff added to check it
out). The line that is commented out used to work before I moved the
images into the individual folders (actually I copied them so the
images show if I uncomment that line and comment out the new way).

Private Sub Form_Current()
On Error GoTo ErrorHandler

'This part I added to see the results in the Immediate Window (see
below)
Debug.Print "D:\ptt\Calhoun\New STM Stuff\New Material\New Graphics\"
_
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

'This is the new way using the subfolder field [VolumeNumber]
[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

'This is the way I had it initially and still works (currently
commented out)
'[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" & [FileName].Value & ".jpg"

GoTo Done

ErrorHandler:
[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\noimage.jpg"

Done:
End Sub

Immediate Window (for the first image) on the form shows correctly:

D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\VOL_02\spanela.jpg

However, the "noimage.jpg" file continues to show and none of the real
images show. Any help (probably so obvious I'll slap myself) would be
appreciated.

TIA!

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
hmm, well, i agree with you that it's strange. you could post the
entire
procedure; maybe one of us will spot something that's causing the
problem.

hth


"Bill Foley" <pttincatitexasdotnet> wrote in message
I tried it and the correct path is showing up for each image. I
have
error
checking in the code to show a "fake image" if it can't find the
correct
image. The fake image is showing up on the form for each record but
when
I
go back into the Immediate Window the correct path is showing up for
each
image. The darndest thing I have ever seen!

Any other ideas? Would it be worth posting the entire
"Form_Current"
code?

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
did you try putting a Break on your code and stepping through it
so you
can
examine the value returned by VolumeNumber.Value? or you can
comment out
the
line of code, and add a Debug.Print line below it, as

Debug.Print "D:\mypath\myfolders\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

run the code from the form as usual, then open the Immediate
window in
the
VB Editor, and examine the printed string to see what may be
incorrect.

hth


"Bill Foley" <pttincatitexasdotnet> wrote in message
Hey Gang,

Access 2003

I have a form with an image holder that is filled with a JPG from
a
folder.
I originally had it hardcoded to that path plus the filename plus
".jpg".
It worked fine, but then I needed to break all images (over 1500
of
them)
into separate folders. I added a field to the table representing
these
new
folders and broke each set of images into their respective
folder. I
am
now
trying to hardcode part of the path and variable the rest and it
is not
working.

This worked before (when all images in the same folder):

[Image19].Picture = "D:\mypath\myfolders\" & [FileName].Value &
".jpg"

Now the last folder in this new path is based on the field
"VolumeNumber".
I have tried the following (and variations) to no avail:

[Image19].Picture = "D:\mypath\myfolders\" & [VolumeNumber].Value
& "\"
&
[FileName].Value & ".jpg"

I am sure I am missing the obvious, but I AM missing it so I need
assistance.

TIA!
 
V

Van T. Dinh

Just a a test, try hard-coding using literal pathname to one of the files
like:

Me.Image19.Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\VOL_02\spanela.jpg"

(watch out for text-wrap! type as one line in your code.)

and see if the correct picture is displayed.
 
B

Bill Foley

I checked typos, etc., as well. I even changed the folder names in case the
underscore wasn't accepted (changed one folder from "VOL_02 to VOL02", with
no avail.

STUMPED!

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
Rob Parker said:
Hi again Bill,

Well, since the file opens OK in Windows Explorer, I'm rather puzzled
also.

Could it perchance be a "non-obvious" typo - perhaps a O and 0 confused,
either in the Access code (or table entry), or in the folder name? You
can probably check this by cutting directly from the path string printed
to the Immediate window via your debug.print statement, and pasting into
the address bar of your browser; does the image file open, or does that
give an error?

Rob

Bill Foley said:
FCS Graphics is the name of the form this code is run on. They always
open fine in Explorer. Matter of fact the previous method (see below)
worked before I broke them out into separate folders.

[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" & [FileName].Value & ".jpg"

It is only when I add the additional field as a variable (same name as
the subfolder) that it stops working. Funny thing is (as you have
probably read in this thread) is that the Immediate Window shows each
correct file path and name when I run the Debug (see below), but the form
will not display them.

Debug.Print "D:\ptt\Calhoun\New STM Stuff\New Material\New Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

For the life of me, I can't figure it out.

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
Rob Parker said:
Bill,

The error message is telling you that the file cannot be opened; I think
it's probably saying 'FCS Graphics ...' because that's the default
association you have set on your system for .jpg files. What happens if
you try to open that file directly (eg. by double-clicking it in Windows
Explorer)?

Rob

"Bill Foley" <pttincatitexasdotnet> wrote in message
When I open the form and first image tries to appear, the error message
says:

"Error number 2220: FCS Graphics can't open the file
'D:\PTT\calhoun\New STM Stuff\New Material\VOL_02\spanela.jpg'.

There aren't any permissions associated with the new folders. There
were merely added subfolders. Is there some sort of path length
problem that I just happened to fall over? Sorry, but I'm grabbing at
straws. This makes no sense to me.

Thanks again for your help!

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
message PMFJI,

I don't see anything obviously wrong, so here's a suggestion which may
help to find the problem:

Your error handler is displaying the default "noimage" image. Try
commenting that out, and replace it with code to display the error
code and message, so you can find what's failing. It may be that the
error is coming from something external - like a typo in the filename,
or no access permission on the new folder, or ...

HTH,

Rob


"Bill Foley" <pttincatitexasdotnet> wrote in message
I just opened the form, went into the code to see the Immediate Window
(see below) and the path to the image is there, but the image itself
did not show up.

Here is the complete code (with the previous stuff added to check it
out). The line that is commented out used to work before I moved the
images into the individual folders (actually I copied them so the
images show if I uncomment that line and comment out the new way).

Private Sub Form_Current()
On Error GoTo ErrorHandler

'This part I added to see the results in the Immediate Window (see
below)
Debug.Print "D:\ptt\Calhoun\New STM Stuff\New Material\New Graphics\"
_
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

'This is the new way using the subfolder field [VolumeNumber]
[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

'This is the way I had it initially and still works (currently
commented out)
'[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" & [FileName].Value & ".jpg"

GoTo Done

ErrorHandler:
[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\noimage.jpg"

Done:
End Sub

Immediate Window (for the first image) on the form shows correctly:

D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\VOL_02\spanela.jpg

However, the "noimage.jpg" file continues to show and none of the
real images show. Any help (probably so obvious I'll slap myself)
would be appreciated.

TIA!

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
hmm, well, i agree with you that it's strange. you could post the
entire
procedure; maybe one of us will spot something that's causing the
problem.

hth


"Bill Foley" <pttincatitexasdotnet> wrote in message
I tried it and the correct path is showing up for each image. I
have
error
checking in the code to show a "fake image" if it can't find the
correct
image. The fake image is showing up on the form for each record
but when
I
go back into the Immediate Window the correct path is showing up
for each
image. The darndest thing I have ever seen!

Any other ideas? Would it be worth posting the entire
"Form_Current"
code?

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
did you try putting a Break on your code and stepping through it
so you
can
examine the value returned by VolumeNumber.Value? or you can
comment out
the
line of code, and add a Debug.Print line below it, as

Debug.Print "D:\mypath\myfolders\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

run the code from the form as usual, then open the Immediate
window in
the
VB Editor, and examine the printed string to see what may be
incorrect.

hth


"Bill Foley" <pttincatitexasdotnet> wrote in message
Hey Gang,

Access 2003

I have a form with an image holder that is filled with a JPG
from a
folder.
I originally had it hardcoded to that path plus the filename
plus
".jpg".
It worked fine, but then I needed to break all images (over 1500
of
them)
into separate folders. I added a field to the table
representing these
new
folders and broke each set of images into their respective
folder. I
am
now
trying to hardcode part of the path and variable the rest and it
is not
working.

This worked before (when all images in the same folder):

[Image19].Picture = "D:\mypath\myfolders\" & [FileName].Value &
".jpg"

Now the last folder in this new path is based on the field
"VolumeNumber".
I have tried the following (and variations) to no avail:

[Image19].Picture = "D:\mypath\myfolders\" &
[VolumeNumber].Value & "\"
&
[FileName].Value & ".jpg"

I am sure I am missing the obvious, but I AM missing it so I
need
assistance.

TIA!
 
B

Bill Foley

Van,

That is a great idea, however, I still get the same result! It almost seems
like I have exceeded my path text limit, but I'm not sure.

For example, this works:

[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" & [FileName].Value & ".jpg"

However, this does not work (even though the files are in both folders):

[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\VOL_02\" & [FileName].Value & ".jpg"

This also does not work (even though the field name [VolumeNumber] is
correct)

[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

I guess I can try and shorten previous folder names to see if that matters.
I would jump out the office window and end it all if I didn't work at home
in a one-story house! HA!

Any other ideas would continue to be appreciated!

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
Van T. Dinh said:
Just a a test, try hard-coding using literal pathname to one of the files
like:

Me.Image19.Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\VOL_02\spanela.jpg"

(watch out for text-wrap! type as one line in your code.)

and see if the correct picture is displayed.

--
HTH
Van T. Dinh
MVP (Access)



Bill Foley said:
FCS Graphics is the name of the form this code is run on. They always
open fine in Explorer. Matter of fact the previous method (see below)
worked before I broke them out into separate folders.

[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" & [FileName].Value & ".jpg"

It is only when I add the additional field as a variable (same name as
the subfolder) that it stops working. Funny thing is (as you have
probably read in this thread) is that the Immediate Window shows each
correct file path and name when I run the Debug (see below), but the form
will not display them.

Debug.Print "D:\ptt\Calhoun\New STM Stuff\New Material\New Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

For the life of me, I can't figure it out.
 
B

Bill Foley

Well, as you would have guessed, it WAS something simple. My original path
to the figures was:

[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New Graphics\

When I created the new folders, I put them directly under "New Material" but
left "New Graphics" in the code. DUH! Oh well, it is working and yes,
everyone's suggestions to check the path and make sure it is correct, was
the right answer.

So, instead of:

[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

It should have been (and now is):

[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

My sincere appreciation for all your help and apologies for my ignorance.
If ignorance is bliss, I am one happy camper! HA!

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
Bill Foley said:
Van,

That is a great idea, however, I still get the same result! It almost
seems like I have exceeded my path text limit, but I'm not sure.

For example, this works:

[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" & [FileName].Value & ".jpg"

However, this does not work (even though the files are in both folders):

[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\VOL_02\" & [FileName].Value & ".jpg"

This also does not work (even though the field name [VolumeNumber] is
correct)

[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

I guess I can try and shorten previous folder names to see if that
matters. I would jump out the office window and end it all if I didn't
work at home in a one-story house! HA!

Any other ideas would continue to be appreciated!

--
Bill Foley
Microsoft Office Specialist Master Instructor
www.pttinc.com
Van T. Dinh said:
Just a a test, try hard-coding using literal pathname to one of the files
like:

Me.Image19.Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\VOL_02\spanela.jpg"

(watch out for text-wrap! type as one line in your code.)

and see if the correct picture is displayed.

--
HTH
Van T. Dinh
MVP (Access)



Bill Foley said:
FCS Graphics is the name of the form this code is run on. They always
open fine in Explorer. Matter of fact the previous method (see below)
worked before I broke them out into separate folders.

[Image19].Picture = "D:\ptt\Calhoun\New STM Stuff\New Material\New
Graphics\" & [FileName].Value & ".jpg"

It is only when I add the additional field as a variable (same name as
the subfolder) that it stops working. Funny thing is (as you have
probably read in this thread) is that the Immediate Window shows each
correct file path and name when I run the Debug (see below), but the
form will not display them.

Debug.Print "D:\ptt\Calhoun\New STM Stuff\New Material\New Graphics\" _
& [VolumeNumber].Value & "\" _
& [FileName].Value & ".jpg"

For the life of me, I can't figure it out.
 

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