Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / September 2007

Tip: Looking for answers? Try searching our database.

Display Multiple Images on a form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
FD - 13 Sep 2007 17:58 GMT
Hi I am a newbie to access and I am trying to save space in my database by
using code to display my images from a folder instead of embedding them
directly into the database.  I have a table with over 2000 records and 2 to 4
images per record.  I am using Access 2003, but the database will be uploaded
to an FTP site then downloaded and used by multilple users with probably
different versions of Access.  I followed the instructions in
http://support.microsoft.com/kb/285820 and it worked great to display one
image per record, but I need to display up to 4 images per record.  Can
anybody help?
S.Clark - 13 Sep 2007 21:54 GMT
strImagePath is passed to the function.  From wherever you produce that
value, do it in a loop and keep passing them until exhausted for that parent
record.

Signature

Steve Clark,
Former Access MVP
FMS, Inc
http://www.fmsinc.com/consulting

> Hi I am a newbie to access and I am trying to save space in my database by
> using code to display my images from a folder instead of embedding them
[quoted text clipped - 5 lines]
> image per record, but I need to display up to 4 images per record.  Can
> anybody help?
FD - 14 Sep 2007 13:56 GMT
Thanks S.Clark.  I will try and figure out how to get a loop in there, but if
you can provide me with the proper code...it will save me hours of research.

> strImagePath is passed to the function.  From wherever you produce that
> value, do it in a loop and keep passing them until exhausted for that parent
[quoted text clipped - 9 lines]
> > image per record, but I need to display up to 4 images per record.  Can
> > anybody help?
FD - 18 Sep 2007 15:22 GMT
Below is my code so far....not sure what or where the code needs to be to
create the loop for each record.  Please help!

Option Compare Database
Option Explicit

Public Function DisplayImage(ctlImageControl As Control, strImagePath As
Variant) As String
On Error GoTo Err_DisplayImage

Dim strResult As String
Dim strDatabasePath As String
Dim intSlashLocation As Integer

With ctlImageControl
   If IsNull(strImagePath) Then
       .Visible = False
       strResult = "No image name specified."
   Else
       If InStr(1, strImagePath, "\") = 0 Then
           ' Path is relative
           strDatabasePath = CurrentProject.FullName
           intSlashLocation = InStrRev(strDatabasePath, "\",
Len(strDatabasePath))
           strDatabasePath = Left(strDatabasePath, intSlashLocation)
           strImagePath = strDatabasePath & strImagePath
       End If
       .Visible = True
       .Picture = strImagePath
       strResult = "Image found and displayed."
   End If
End With
   
Exit_DisplayImage:
   DisplayImage = strResult
   Exit Function

Err_DisplayImage:
   Select Case Err.Number
       Case 2220       ' Can't find the picture.
           ctlImageControl.Visible = False
           strResult = "Can't find image in the specified name."
           Resume Exit_DisplayImage:
       Case Else       ' Some other error.
           MsgBox Err.Number & " " & Err.Description
           strResult = "An error occurred displaying image."
           Resume Exit_DisplayImage:
   End Select
End Function

> strImagePath is passed to the function.  From wherever you produce that
> value, do it in a loop and keep passing them until exhausted for that parent
[quoted text clipped - 9 lines]
> > image per record, but I need to display up to 4 images per record.  Can
> > anybody help?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.