472,125 Members | 1,459 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Displaying images in continuous forms

I have been researching for several hours on the best way to display
images in continous forms in Access 2003. For example, I want to
display employee name, email, phone, and picture for each record in
the recordset. I can have the pictures converted to any usable
format, use OLE or linking, whatever needs to be done.

So far, the 3 possible solutions I have found are:

1) OLE objects - if you don't have bitmaps associated just perfect, a
tiny thumbnail with the filename appears instead of the full image.
This may be something to do with the OLE type being stored as
"Package" rather than "Bitmap image". I couldn't figure out how to
store as "Bitmap Image", even if I did: Me.Picture1.Class =
"Paint.Picture".

2) ActiveX image control - so far, I have found a few ActiveX image
controls, however, ActiveX controls can't be used with continuous
forms.

3) ActiveX grid/list control - I couldn't find a simple datagrid or
datalist component that would simply display the picture and a few
columns. This seems like the most logical way.

Putting a command button with "click to view image" isn't really an
option because we need to be able to see multiple pictures at a time.

I know that Access 2007 is supposed to make this easier, however, it
isn't an option since no runtimes will be released until at least
June.

Has anyone successfully found a workaround to this problem?

Thanks

Apr 14 '07 #1
1 10596
bl*********@gmail.com wrote:
I have been researching for several hours on the best way to display
images in continous forms in Access 2003. For example, I want to
display employee name, email, phone, and picture for each record in
the recordset. I can have the pictures converted to any usable
format, use OLE or linking, whatever needs to be done.

So far, the 3 possible solutions I have found are:

1) OLE objects - if you don't have bitmaps associated just perfect, a
tiny thumbnail with the filename appears instead of the full image.
This may be something to do with the OLE type being stored as
"Package" rather than "Bitmap image". I couldn't figure out how to
store as "Bitmap Image", even if I did: Me.Picture1.Class =
"Paint.Picture".

2) ActiveX image control - so far, I have found a few ActiveX image
controls, however, ActiveX controls can't be used with continuous
forms.

3) ActiveX grid/list control - I couldn't find a simple datagrid or
datalist component that would simply display the picture and a few
columns. This seems like the most logical way.

Putting a command button with "click to view image" isn't really an
option because we need to be able to see multiple pictures at a time.

I know that Access 2007 is supposed to make this easier, however, it
isn't an option since no runtimes will be released until at least
June.

Has anyone successfully found a workaround to this problem?

I solved this issue but creating my own form to mimic a continuous form with unbound
controls and then I handle all the code to place the images in. The form does have some
bound controls for data but the unbound controls I used to mimic continuous forms are
populated in the OnCurrent event.

So as you navigate through the records code retrieves the appropriate image path and fills
the image control.

The drawback is that it requires code so you should be comfortable with working with VBA
code. This code is taken from an old *demo* project. The controls and fields names have
meaning in that context.

Perhaps this sparks an idea for a solution for you.

Const NUM_SUBPARTS_SUPPORTED As Integer = 4

Private Sub Form_Current()
Dim sPath As String

sPath = CurrentProject.Path & "\" ' use the same folder the database is in

' if file exists
If Not IsNull(Me.txtParentPicture) And Len(Dir(sPath & Me.txtParentPicture)) 0 Then
Me!imgParentPicture.Picture = sPath & Me!txtParentPicture
Else
Me!imgParentPicture.Picture = "(none)" ' otherwise display nothing
End If

' load the "sub-form" items here
Dim dbs As Database, rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT * FROM SubParts" & _
" WHERE ParentPartNum = '" & Me!txtParentPartNum & "'")

If Not rst.EOF Then
rst.MoveLast
rst.MoveFirst ' set the recordcount property
End If

Dim x As Integer
For x = 1 To NUM_SUBPARTS_SUPPORTED
If x <= rst.RecordCount Then
' have a valid part
Me("txtPartNumber" & x) = rst!PartNumber
Me("txtPartNumber" & x).Visible = True
Me("txtQtyNeeded" & x) = rst!QtyNeeded
Me("txtQtyNeeded" & x).Visible = True
Me("txtPointOfUse" & x) = rst!PointOfUse
Me("txtPointOfUse" & x).Visible = True
Me("txtDWG" & x) = rst!DWG
Me("txtDWG" & x).Visible = True
Me("txtDescription" & x) = rst!Description
Me("txtDescription" & x).Visible = True

If Not IsNull(rst!PartTopPicture) And _
Len(Dir(sPath & rst!PartTopPicture)) 0 Then
Me("imgTop" & x).Picture = sPath & rst!PartTopPicture
Else
Me("imgTop" & x).Picture = "(none)"
End If
Me("imgTop" & x).Visible = True

If Not IsNull(rst!PartSidePicture) And _
Len(Dir(sPath & rst!PartSidePicture)) 0 Then
Me("imgSide" & x).Picture = sPath & rst!PartSidePicture
Else
Me("imgSide" & x).Picture = "(none)"
End If
Me("imgSide" & x).Visible = True

' do the lines and labels
Me("Line" & x).Visible = True
Me("LabelA" & x).Visible = True
Me("LabelB" & x).Visible = True
Me("LabelC" & x).Visible = True
Me("LabelD" & x).Visible = True
Me("LabelE" & x).Visible = True
Else
' exhausted all sub-records, just set subform controls invisible
Me("txtPartNumber" & x).Visible = False
Me("txtQtyNeeded" & x).Visible = False
Me("txtPointOfUse" & x).Visible = False
Me("txtDWG" & x).Visible = False
Me("txtDescription" & x).Visible = False
Me("imgTop" & x).Visible = False
Me("imgSide" & x).Visible = False
Me("Line" & x).Visible = False
Me("LabelA" & x).Visible = False
Me("LabelB" & x).Visible = False
Me("LabelC" & x).Visible = False
Me("LabelD" & x).Visible = False
Me("LabelE" & x).Visible = False
End If

' if more records, lets see 'em
If Not rst.EOF Then
rst.MoveNext
End If
Next x

rst.Close
Set rst = Nothing
Set dbs = Nothing

End Sub
--
---------------
John Mishefske, Microsoft Access MVP
Apr 15 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Lauren Quantrell | last post: by
2 posts views Thread by Phil Stanton | last post: by
reply views Thread by leo001 | last post: by

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.