Slider Bar for Survey

J

jimtotem

Is there a way to program/insert a slider bar or thermometer type of graphic
to enter a value between a range of values. Maybe detecting cursor position?
I have used an option group, but not the effect that I want.

I am somewhat comfortable with VBA, not an expert.

Thank you for anticipated help!

Jim
 
G

GraemeR

Hi Jim, there are third party controls for this e.g. Microsoft Slider
Control that you may have installed on your system. I think it's part of VB.

To create the whole thing in MS Access I would place a label and a couple of
lines on a form.
Place a horizontal line on the form and set it's style to Chiseled. This
will be your slider.
Place a label (named lblBackground) over the line (background
transparent)Make it tall enough to easily catch the MouseDown and MouseMove
events (a line isn't tall enough.)
Place a space in the Label so that MS Access doesn't delete the control on
exiting it.
Place a short vertical line on the form (called linMarker) to mark where the
user clicked.

To indicate where a user clicked on the slider

Private Sub lblBackground_MouseDown(Button As Integer, Shift As Integer, X
As Single, Y As Single)

linMarker.Left = lblBackground.Left + X
linMarker.Width = 0

End Sub

Obviously you can trap the MouseMove event to add some flare.
Also, use something a little more creative than a vertical line for the
marker.
Cheers, Graeme.
 
J

jimtotem

Thank you Graeme,
I will try this out today. I appreciate your response to my need.
Jim
 
R

Rob Parker

Seems I missed the original post. But is there any reason you don't simply
use the Microsoft Slider Control? It will save you re-inventing the wheel.
Right-click on the control in design mode, then select Slider Object -
Properties, and you'll be able to set min and max values, major/minor scale
divisions, orientation, ...

To find the control, click the "More tools ..." button on the toolbox, and
scroll down until you find it. You'll almost certainly have it - I've got
it on several systems I use, including an old "plain vanilla" system with
Access 97.

HTH,

Rob
 
S

Stna

Rob,

I was looking for some help on line around the use of sliders controls and
saw the thread.

Do you have any example code of using a slider control and linking the data
to a field in a table?

I would appreciate it if you do.

Regards

Stan
 
Top