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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I add photos to my database and store them in Access?

Status
Not open for further replies.

warp9

Technical User
Jun 7, 2004
1
0
0
US
Hi, I have been looking into how I can store photos in access and then add them into reports. I've been able to do this with image files (gifs) but not jpegs or tiffs.

I actually want the photos to appear in the database as thumbnails, so when I do my research I can see them. Then I'll select the records I need and either print or fax a report.

Any assistance you can give would be greatly appreciated. Thanks, Pam.
 
Actually the code doesn't stop anywhere. I just recieve an error message the Access can't find the macro 'Me!PictureImage.'
The message goes on to say...
The macro (or its macro group) doesn't exist, or the macro is new but hasn't been saved. Note that when you enter the macrogroupname.macroname syntax in an argument, you must specify the name the macro's macro group was last saved under.

I proceeded to put two more form controls, one for next record and one for previous record. In each in the VBA code I entered the Me![PictureImage].Picture = Me![ImagePath] line after the acNext and acPrevious lines respectively. Then when I go back and use these controls the images load to the PictureImage box. Yet when I use the arrows at the bottom of the page the above error message appears. I have tried to ensure the only controls on the page are the ImagePath text box, PictureImage image box and now the two directional controls.

Thank you,
Steve
 
Bob,
I created an Event Procedure for the form's On Current attribute, placed the Me![PictureImage].[Picture]=Me![ImageControl] there (in the VBA code) and the form now allows browsing through images using the record buttons at the bottom of the form or navigation buttons I added. Still don't know why I couldn't place the code directly into the "On Current" attribute box but, it works.

In case I didn't explain myself previously. I would get the "Microsoft can't find macro.." error pop up window, yet when I clicked "ok" it would simply disappear and not go to the code and highlight a section (as it would if you misspelled a word or there was a type mismatch). That's why I couldn't provide any more info.

Thank you,
Steve
PS I gave you a star for the great info you've posted and time and effort put into these questions. Thanks again
 
sterobw: I am glad that you got things working okay. Yes, the forms OnCurrent event procedure executes everytime the form moves to a new record, so both your custom buttons and the forms navigation buttons will trigger that code to work. But, your first paragraph seems to be confusing to me. You quoted the following:

[highlight]I created an Event Procedure for the form's On Current attribute[/highlight], placed the Me![PictureImage].[Picture]=Me![ImageControl] there (in the VBA code) and the form now allows browsing through images using the record buttons at the bottom of the form or navigation buttons I added. [highlight]Still don't know why I couldn't place the code directly into the "On Current" attribute[/highlight] box but, it works.

Thanks for the star by the way. Really is appreciated. I always enjoy working with these Image control questions as everyone seems to want to get it to work in their situation just a little differently. Always a challenge.

The two highlighted statements above seem to contradict themselves. I am only pointing this out to try to understand what you meant. The forms OnCurrent event procedure is the only one really in play here. You could remove the code from your custom navigation buttons and just rely upon the code in the forms OnCurrent for both of the record movement activities. Just was wondering where else you had the code.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
In Jun 18, 2004 i have posted a working sample of a database storing pictures which can be found here:
This is working on my win98 pc, but not on win xp. The database does not disply an image when under winXP and opens up the debugger. Can anybody suggest something to make it work on winxp as i m changing pc now?

Thank you
Andy
 
andyukcy, your database displays the images on my platform: access 2003 and winXP pro.
Have you tried to check the references ?
When in VBE, menu Tools -> References ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I have changed the event procedure of the browse button to :
Private Sub browse()

On Error GoTo ErrCommonDialog1
GetFileInformation (Find_File(glInitDir))
Me!txtPicture = glFileName
Me!txtPathToHyperlink = "#" & glFileName
Me!Picture.Picture = GetPathPart & Me!txtPicture
ErrCommonDialog1:
End Sub


This solved the problem i had with win XP, solved the problem that all pictures should be placed in the same folder as the database (now you can add pictures from anywhere in your computer - Win XP), and the picture shows in the box as soon as you select it from the browse function.

Thank you
Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top