Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying bitmap or jpeg images in forms

Status
Not open for further replies.

bhujanga

Programmer
Oct 18, 2007
181
US
I have a form that shows phows a bunch of information for roadside signs including any number of photos that have been taken of the signs. I use an 'image'object to show the selected photo. Up until now all of the photos have been jegs and it has been working fine. Now they have a gps device that they take the photos with and they are bmp files. Evidently this is not a valid file format for this object. I tried using an unbound object frame but I couldn't get anything to appear. How do I create an object that will accept either of these formats?
Thank you.
 
The Image control from the toolbox displays bmp's just fine.
How are you trying to load the image into it? Can you post back some VBA?

Cogito eggo sum – I think, therefore I am a waffle.
 
This is the code I'm using.


Private Sub AddPhoto_Click()
DoCmd.GoToRecord , , acNewRec
Dim stDocName As String
Dim Path As String
Path = DLookup("[Path]", "SystemData") & "\Photos\"
On Error GoTo TestError

With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.InitialFileName = Path
.Show
rtnFile = .SelectedItems(1)
End With

Me![FileName] = rtnFile
Me![DateAdded] = Date
Forms![Basicinfo]![DefaultPhoto] = rtnFile
Forms![Basicinfo]![AttachedPhotos]![PhotoTitle] = InputBox("Enter a description for the photo:")


'Display the selected photo
On Error GoTo InvalidPhoto

Forms![Basicinfo]![PhotoWarning] = ""
Forms![Basicinfo]![Image105].Picture = Me![FileName]
Exit Sub

InvalidPhoto:
Forms![Basicinfo]![PhotoWarning] = "Either no photos have been added or the referenced file is not a valid image file"
Path = DLookup("[Path]", "SystemData") & "\Photos\"
Forms![Basicinfo]![Image105].Picture = Path & "NoPhoto.jpg"
Resume ExitfromError

TestError:
If Err.Number = 5 Then Exit Sub Else Resume


ExitfromError:


End Sub
 
I may not be too much help here, as I always code unbound forms. It looks like you are updating the underlying recordset
with Me![FileName] = rtnFile. If that is the case, I don't believe the implicit update transaction will be committed until you do an explicit .Update, or physically scroll off the record.
That being said, try loading your image control with
Forms![Basicinfo]![Image105].Picture = rtnFile instead of Me![FileName]. Just a guess - hope it helps!

Cogito eggo sum – I think, therefore I am a waffle.
 
I guess it has something to do with these particular image files. I tried using some different bitmaps and it worked with those. For some wierd reason Access isn't understanding these particular bmp files even though other image programs do. Thanks for trying to assist.
 
Sorry I shot a blank.
What are they images of? Could they be DRM protected?

Cogito eggo sum – I think, therefore I am a waffle.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top