Getting images from filesystem in forms and reports.

V

Veli Izzet

Hi all,

I keep the images in the filesystem, and get the images to forms and
reports using:

********
If Len(Dir(CurrentProject.Path & "\slides\" & Left(Me![TakiID], 8) &
".jpg")) Then
Me![ImagePic].Picture = CurrentProject.Path & "\slides\" &
Left(Me![TakiID], 8) & ".jpg"
Else
Me![ImagePic].Picture = ""
End If
***********

I have two problems:

1- On the forms, when I am browsing, sometimes, the code that gets the
image somehow kind of hangs, and the "Importing:bla bla" portion stays
on top of the screen.

I have to quit Access, go to task manager and kill an Access process.


2- I want to keep the images (slides folder) anywhere (not only under
currentProject Path) relative to the project path. I could not find the
right syntax. Maybe ".\"&CurrentProject.Path& "\slides...... ???

Thanks for any help.
 
A

Arvin Meyer [MVP]

VBA sometimes has a problem with booleans. Try being explicit. Instead of
this line:

If Len(Dir(CurrentProject.Path & "\slides\" & Left(Me![TakiID], 8) &
".jpg")) Then

Try:

If Len(Dir(CurrentProject.Path & "\slides\" & Left(Me![TakiID], 8) &
".jpg")) > 0 Then
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
V

Veli Izzet

Yes, that was it..

Thanks, any hint about the second part of the question?

VBA sometimes has a problem with booleans. Try being explicit. Instead of
this line:

If Len(Dir(CurrentProject.Path & "\slides\" & Left(Me![TakiID], 8) &
".jpg")) Then

Try:

If Len(Dir(CurrentProject.Path & "\slides\" & Left(Me![TakiID], 8) &
".jpg")) > 0 Then
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Hi all,

I keep the images in the filesystem, and get the images to forms and
reports using:

********
If Len(Dir(CurrentProject.Path & "\slides\" & Left(Me![TakiID], 8) &
".jpg")) Then
Me![ImagePic].Picture = CurrentProject.Path & "\slides\" &
Left(Me![TakiID], 8) & ".jpg"
Else
Me![ImagePic].Picture = ""
End If
***********

I have two problems:

1- On the forms, when I am browsing, sometimes, the code that gets the
image somehow kind of hangs, and the "Importing:bla bla" portion stays
on top of the screen.

I have to quit Access, go to task manager and kill an Access process.


2- I want to keep the images (slides folder) anywhere (not only under
currentProject Path) relative to the project path. I could not find the
right syntax. Maybe ".\"&CurrentProject.Path& "\slides...... ???

Thanks for any help.
 

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