By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,531 Members | 855 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,531 IT Pros & Developers. It's quick & easy.

Access and pictures

P: n/a
Good evenig to all,

I use Access 2000 and i want to build a database for my
photographs (jpeg files). All the 3 methods I saw
make the base grow up. Is it a activeX control which could
display the picture without importing it in the base ? and where
could I find it.
Thank you

Alan
--
_________________________________

Site photo personnel :

http://perso.wanadoo.fr/dimphoto
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
The way to view photos in Access without storing the photos in Access is
to store the photos in some directory specifically designated for your
photos. Then you can use the Dir function to retrieve the location of
each photo in the directory and display it in an Image control on a form
in Access:

Sub GetPics()
Dim Pic As String, Path As String, i As Integer
Path = "C:\PicDir\"
Pic = Dir(Path & "*.jpg")
Do While Pic <> ""
Image1.Picture = Path & pic 'Path and Picture argument
msgbox "Pause"
Pic = Dir
Loop
End Sub

This loop is real basic. The Dir function retrieve the Picture name and
appends it to the Path that you have specified. You assign the Path &
Pic to the Image1.Picture property. Then I call a msgBox function to
pause the loop so you can view the picture. When you click OK on the
Pause Message the loop continues and picks up the next picture in your
directory.

Instead of a simple loop like the one above, you could retrieve all the
pictures into either an array or even a collection object. Now you can
specify the index of the object containing your list of pictures to view
a specific picture, or you could loop through the object/array as above.
Instead of using a loop, also, you could use a Static counter (Static i
As Integer). This way you could click on a button and increment your
counter without losing the previous value and view your pictures that
way.

Say you have loaded a Module Level array with your pictures, you can
click through the array with the procedure below:

Private Sub cmd1_OnClick()
Static i As Integer
i = i + 1
If i > Ubound(PicArray) Then i = 0
Image1.Picture = PicArray(i)
End Sub

Just some ideas.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #2

P: n/a
There are downloadable sample databases illustrating three approaches to
handling images in Access databases at http://accdevel.tripod.com. Feel free
to use the code as a starting point if it meets your needs, but understand
those are just examples, not "polished applications".

Larry Linson
Microsoft Access MVP

"Alain." <_@wanadoo.fr> wrote in message
news:bj**********@news-reader1.wanadoo.fr...
Good evenig to all,

I use Access 2000 and i want to build a database for my
photographs (jpeg files). All the 3 methods I saw
make the base grow up. Is it a activeX control which could
display the picture without importing it in the base ? and where
could I find it.
Thank you

Alan
--
_________________________________

Site photo personnel :

http://perso.wanadoo.fr/dimphoto

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.