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

How To Rotate Thru a set of Pic's

P: n/a
Hello

I have On a form an Unbound Picture (BMP) that I would like to be able
to change by clicking on it and having it got display the next Pic in the List.

Like This:

I Open The Form (Normally) and when I click on the Pic, it will rotate to the
Next Pic in the list (About 16 In Total), After the last one it goes back to the
first pic again.

Is this possible in Access, How much coding is involved?

Thanks

Keith
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
1. Create an image control, with "(none)" as the Picture property, and
Picture Type property "Linked"
2. Create a button, and place it completely over the image control. Set
it's Transparent property to "Yes"
3. Create a table with the full path of each photo:
photo_id photo_path
1 "C:\images\image1.bmp"
2 "C:\images\image12.bmp"
4. Declare form level variables:
Private photoID as Long
Private imageCount as Integer
5. In your form's Load event, load your first image from your table & store
the photo_id:
[Open recordset rs]
photoID = rs.Fields(0)
Me.imgPhoto.Picture = rs.Fields(1)
[Close recordset]
[Count records in recordset and store in imageCount] (you can use
DCount)
6. In your buttons OnClick event:
Dim cnt As Integer
[Open recordset rs]
[rs.MoveNext until rs.Fields(0) = PhotoID, incrementing cnt as you go]
If cnt = imageCount
rs.MoveFirst
Endif
photoID = rs.Fields(0)
Me.imgPhoto.Picture = rs.Fields(1)

It could be made much simpler if you name the images 1.bmp, 2.bmp, etc and
used a hardcoded path, but this allows you to have file names that are not
important to the code, a variable number of images, and variable file
locations.

Darryl Kerkeslager
<ca*****@hotmail.com> wrote:
I have On a form an Unbound Picture (BMP) that I would like to be able
to change by clicking on it and having it got display the next Pic in the List.
Like This:

I Open The Form (Normally) and when I click on the Pic, it will rotate to the Next Pic in the list (About 16 In Total), After the last one it goes back to the first pic again.

Is this possible in Access, How much coding is involved?

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.