473,406 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Display an image using an expression?

Novice Access programmer here.

I would like to display an image using the Toolbox Image object by
calling the images file name using:

=fPictureFiles([Forms]![frmPatients]![cboTitleofCourtesy],1)

in the Picture control.

Below is the function which DOES actually returns a valid file
location such as:

c:\Pictures\pic01.jpg

The Picture control seems to only accept an actual file location and
not an expression.

What am I missing?

Thanks in advance to all you pro's.
Here's the Function, which when tested in the Immediate Window works
perfectly:

Function fPictureFiles(strDir As String, lngPictureNumber As Long) As
String

Dim fs As Object

Set fs = Application.FileSearch
With fs
.LookIn = strDir
.FileName = "*.*"
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
If i = lngPictureNumber Then
fPictureFiles = .FoundFiles(i)
End If
Next i
Else
MsgBox "There were no files found."

End If
End With

Set fs = Nothing

End Function
Nov 13 '05 #1
1 2657
Sorry for the error. I messed up my function call on the original
post. This is the function call I want to put in the Picture control
to call my image to the image box on the form.

=fPictureFiles([Forms]![frmPatients]![tboPictureDirectory],1)

The tboPictureDirectory displays a table field holding the location of
the patients pictures and comes from a form that calls the picture
form to display pictures. The 1 shown above signifies the first file
in the folder is to be displayed in this image box.

bb*******@gmail.com (bborden) wrote in message news:<ea**************************@posting.google. com>...
Novice Access programmer here.

I would like to display an image using the Toolbox Image object by
calling the images file name using:

=fPictureFiles([Forms]![frmPatients]![cboTitleofCourtesy],1)

in the Picture control.

Below is the function which DOES actually returns a valid file
location such as:

c:\Pictures\pic01.jpg

The Picture control seems to only accept an actual file location and
not an expression.

What am I missing?

Thanks in advance to all you pro's.
Here's the Function, which when tested in the Immediate Window works
perfectly:

Function fPictureFiles(strDir As String, lngPictureNumber As Long) As
String

Dim fs As Object

Set fs = Application.FileSearch
With fs
.LookIn = strDir
.FileName = "*.*"
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
If i = lngPictureNumber Then
fPictureFiles = .FoundFiles(i)
End If
Next i
Else
MsgBox "There were no files found."

End If
End With

Set fs = Nothing

End Function

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Yves PEYSSON | last post by:
Hi, I want to display the same image (from the same file) at different positions in a window. Up to now I used DIV command in the body part of the text, and document.getElementById in order to...
9
by: Wally | last post by:
I am trying to display images from an Access 2000 database and I get an error "Invalid Parameter Used" when I execute the code line "picBLOB.Image = Image.FromStream(stmBLOBData)" in my Visual...
4
by: Kevin Myers | last post by:
Hello, Please forgive my reposting of this note with hopefully a more relevant subject line. On an Access 2000 form under Windows 2000 I would like to use a Kodak Image Edit Control to...
5
by: moondaddy | last post by:
I'm caching a dataset in an asp.net session variable to hold a user's data. one data item I need to store is an image the user uploaded. My problem is that I don't know how to get the image into...
5
by: Peter Lapic | last post by:
I have to create a image web service that when it receives an imageid parameter it will return a gif image from a file that has been stored on the server. The client will be an asp.net web page...
3
by: Bama | last post by:
I already stored the image in the SQL database. How do I retrieve it? Any help is appreciated.
9
by: tshad | last post by:
This was posted before but the message got messed up (all NLs were stripped out for some reason). I have 2 labels that hold the name of different images on my .aspx page. <asp:Label ID="Logo"...
1
by: nanaalwi | last post by:
Hi, Currently I'm developing a software using VB.net that can grab an image using Matrox Morphis card and display it in a PictureBox. The software can grab the image already and display it in the...
3
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= | last post by:
I have a asp.net app, in the page there is a scan activex which could scan and save a jpg file in client harddisk. How could we access and display this jpg file on the fly using js in the client...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.