Using a scrollbar control

Ratter

New member
Local time
Today, 14:18
Joined
Jan 5, 2008
Messages
7
Does anyone know how to use a scrollbar control on an Access 2003 form? I have tried using an MSForms scrollbar but can't find any documentation or examples.

All I want to do is to set the min and max values for it and detect where it is between those values
 
The problem is that you're trying to use the wrong control! Scrollbars are used to scroll thru a control that is too small to display everything at once. What you're describing is a Slider control! My version of Access 2003 offers Microsoft Slider Control 5.0 and Microsoft Slider Control 6.0.

Place the Slider contol on your form.
Goto Properties - Other and set the Minimum and Maximum Properties

Then use this code, where YourTextBox is the name of the control that you want the value to be placed in.

Code:
Private Sub YourSlider_Change()
  Me.YourTextBox = Me.YourSlider
End Sub
I suppose you could bind the slider to a field in your table, but I wouldn't do this, as these controls are somewhat sloppy! If you bind it to the form, you can't really tell exactly what value has been selected. If you place the value in a textbox, you can visually check it and make adjustments if need be.

Linq
 
Last edited:
Thanks, that looks good and the slider is pretty self-explanatory but my slider (5.0 or 6.0) doesn't have an OnChanged event only an OnUpdated one which doesn't seem to fire when you move the slider.

Not sure what I'm doing wrong
 
Sorry, should have warned you! :D Access is kind of weird when it comes to ActiveX controls in that the property box frequently doesn't list all the events associated with the control!

From Design View for the form, goto View and click on Code.

You're now in the code module or window. Near the top you'll see two dropdown boxes.

Dropdown the one that says (General) and select the name of your slider.

Now dropdown the one that says (Descriptions). As you can see, you now have more events available than you did in the Properties Box! Select Change.

You should now see

Private Sub YourSlider_Change()

End Sub


Add the line of code to get

Private Sub YourSlider_Change()
Me.YourTextBox = Me.YourSlider
End Sub


and you're done.

Linq
 
Thanks for that Linq.

I do remember about that now - one of Access's many curiosities.
 

Users who are viewing this thread

Back
Top Bottom