Can Excel have this type of Form

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
2,120
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Like Access, where record selectors are shown?
I want to have a picture viewer where a bunch of images can be cycled.
I was thinking of using the whole Form size for the picture, but this makes it hard to have a way of moving to the next, last etc.
Any ideas would be most welcome.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
First, make a ListObject table, this example uses one column. Then, create your form, add a image control, a previous button and a next button. Finally, adapt this code with your names and add it to your form:
VBA Code:
Option Explicit

Private r As Long, count As Long

Private Sub PreviousImageButton_Click()
    r = IIf(r = 1, count, r - 1)
    UpdateImage
End Sub

Private Sub NextImageButton_Click()
    r = IIf(r = count, 1, r + 1)
    UpdateImage
End Sub

Private Sub UserForm_Initialize()
    r = 1
    count = [PathsTable].ListObject.ListRows.count
    UpdateImage
End Sub

Private Sub UpdateImage()
    Me.Image1.Picture = LoadPicture([PathsTable].ListObject.DataBodyRange(r))
End Sub

That should cycle.
 
Upvote 0
Like Access, where record selectors are shown...I was thinking of using the whole Form size for the picture, but this makes it hard to have a way of moving to the next, last etc.
First, as a general rule, I'd say if you are thinking of doing something that makes everything else difficult, it's usually best to rethink. ;)

Second, an Access form doesn't really use the whole form for any one thing. There are sections for the record selector, and the navigation items. I don't see why you couldn't create a similar looking thing in a userform.
 
Upvote 0
Alexander just need records, hence the list object.
Buttons are also necessary to cycle, hence the previous and next button.

That's it for what the Access form does. Since the requirement doesn't really cover any necessity about record selectors or events, only navigation, the code above takes care of it.
 
Upvote 0

Forum statistics

Threads
1,225,757
Messages
6,186,848
Members
453,379
Latest member
gabriellegonzalez

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top