I would like to be able to have an Image displayed, then be able to click on the Image to change it to a different Image. A total of four Images, just keep stepping through the four Images in a revolving way. Thanks
I would like to be able to have an Image displayed, then be able to click on the Image to change it to a different Image. A total of four Images, just keep stepping through the four Images in a revolving way. Thanks
Are images located in external folder or embedded in table?
If external folder, use a global variable or TempVars. Code increments value with each click. Value determines which image to load.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
I could put the pictures either way, which ever is easiest/best.
I'm just a newbie, would I declare a variable like varImage1 in the Global Module then set it to an image somehow?
Embedding files such as images or documents uses up Access 2GB file size limit.
No, would not set variable with image, set it with sequence number. Variable declared in general module and code behind form to set Image control ControlSource property. Assumingeach set of 4 images has naming that corresponds to some identifying field in table with a number suffix - something like:
Then would also need to reset global variable when moving to a new record. So code in form Current event:Code:Sub imgPics_Click() If gblSeq = 4 Then gblSeq = 0 gblSeq = gblSeq + 1 Me.imgPics.ControlSource = "=C:\folderpath\" & Me.fieldname & gblSeq & ".jpg" End Sub
gblSeq = 1
Me.imgPics.ControlSource = "=C:\folderpath\" & Me.fieldname & "1.jpg"
One issue with global variables is they lose value when code encounters runtime error. Alternatives are to set value of an UNBOUND textbox on form or use TempVars.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Another approach would be to use two buttons next to the image to move to the next or previous image.
That approach would also use a 'sequence' approach similar to that suggested by June7
Thanks June7
That worked for me except I had to replace Me.imgPics.ControlSource with Me.imgPics.Picture, it didn't seem to like ControlSource
Glad you figured it out. I've never actually had to do this. Now I see that ControlSource of image control cannot be set programmatically, unlike other controls that have this property. However, can call a function that returns complete image path. But what you have is probably simpler.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
I just alter the Picture property in the form Current event, so a function isn't really needed if the path is a field in the record. If you have 4 pics related to 1 record, you'd need a parent/child record type of relationship and a way (other than Current event) to cycle through them.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.