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!