Solved

slider in access

Posted on 2013-01-08
21
1,704 Views
Last Modified: 2013-01-08
I would like a slider that goes in value from 1 to 250, I have added the active x slider on the form but not sure how to get the slider to slide and return the new values the idea being that the user selects a value with the slider and then a filter is created from that value.
0
Comment
Question by:PeterBaileyUk
  • 8
  • 7
  • 4
  • +1
21 Comments
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 334 total points
ID: 38754337
To set the min and max values of the slider, open the properties dialog and click on the "Other" tab, you will see options for Min, Max,Small Change, and Large change; adjust those as needed.

The Slider bar (MS Slider Control 6.0) has a Change event that is not visible in the Events tab of the Properties window.  Open the VBA editor, select the slider control from the dropdown, then expand the events list and you will see the Change event.

Use that event to set the value of a textbox if you want to see the current value of the slider.

Otherwise, you can simply use the value of the slider for whatever you want.

Private Sub Slider01_Change()

     me.txt_SliderValue = me.Slider01.value

End sub
0
 
LVL 39

Expert Comment

by:als315
ID: 38754347
Look at sample
0
 

Author Comment

by:PeterBaileyUk
ID: 38754359
on the other tab I dont have those options unless its the wrong slider control: i have MSComctlLib.Slider.2 from slider control version 6 under active x controls
0
 

Author Comment

by:PeterBaileyUk
ID: 38754373
its ok i found it in a sub section
0
 
LVL 39

Assisted Solution

by:als315
als315 earned 166 total points
ID: 38754375
Sorry, sample was not attached
DBSlider.mdb
0
 

Author Comment

by:PeterBaileyUk
ID: 38754383
when i try to change the values it says invalid property, its under custom.
0
 

Author Comment

by:PeterBaileyUk
ID: 38754395
Its strange if I just close the dialogue it accepts the change, it wont accept apply.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38754410
"on the other tab I dont have those options unless its the wrong slider control"

Which options?slider control with options
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38754417
Slider code
0
 

Author Comment

by:PeterBaileyUk
ID: 38754419
Ok I am having trouble finding: select the slider control from the dropdown, then expand the events list and you will see the Change event.

I found on the left side the properties of bhpSlider (my name for it) I clicked the cross to open event but the hidden change event didnt appear.
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 334 total points
ID: 38754473
In the form design mode, press Ctrl-G to open the code window.

At the top of the code window you will see two dropdowns, the one on the left is to select the control (you will see the Form, Detail, Header, and control names in that drodown).  Once you select the slider control, the right dropdown will display the events that are available for the control.  This is the complete list of ActiveX events for the slider, what is displayed in the Properties Dialog -> Event tab is incomplete.
0
 

Author Comment

by:PeterBaileyUk
ID: 38754483
I dont have that change event, i created a new slider control and the dropdown only has 5 events but no change event as far as I can see.

I tried adding manually:
Private Sub BHPSlider_Change()

    MsgBox "Changed" & Me.BHPSlider.Value

End Sub
0
 
LVL 39

Expert Comment

by:als315
ID: 38754492
Dale, can you make a screenshot from Data tab of Silder control properties? A also have no Change event for this control and Other Tab looks different from yours
slider
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38754575
As I stated above, the Change event for the slider is only visible in the CODE window, not in the form design or in the Property Dialog.

1.  Open your form in Design view.
2.  Press Ctrl-G (this will open the VBA Code window)code window3.  At the top of that form, in the drop-down on the left, select the slider control (in your case, it should read "Slider1")
4.  In the Events drop-down, select the Change event.

The data tab on my properties window only has three entries:data tab
0
 
LVL 39

Expert Comment

by:als315
ID: 38754888
Very strange, Class is the same. Can you show version of mscomctl.ocx (system32 or SysWOW64). I have version 6.1.98.34. Other tab for this control has only few options (it was cutted on previous screenshot, but there is only one line more)slider
0
 

Author Comment

by:PeterBaileyUk
ID: 38755236
as it turns out i didnt need the change event, fortunately as I looked exactly where you said in the vba code window and the change event is not there. Anyway I only required the value of the slider and its worked perfectly well in my case. Still curious as to why the change event cannot be seen, I am in win 8, access 2010.
0
 

Author Closing Comment

by:PeterBaileyUk
ID: 38755244
I have split the points hope thats satisfactory to both.
Regards
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38755256
@als,

I'm using the system32 version of the Common Controls 6.0 (SP6).  But I'm not sure how to get the Version # of that.

@Peter,

You should also be able to get to the Min/Max values by right clicking on the slider control, then selecting the "Slider Object" -> Properties, then click the "General" tab on the Slider Properties dialog.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38755263
I guess I failed to see your reference to Win8, Access 2010.  Are you using 32 or 64 bit Office?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38755371
But lets go back for a moment.

Why not just use the "Scroll Bar" control?
It does not have the fancy tickmarks, (they can be simulated easily with labels) but it does what you ask for...
<get the slider to slide and return the new values the idea being that the user selects a value with the slider and then a filter is created from that value. >
(Still can only access the Change Prop form VBA though...)

Sample attached...

Then you can filter with something roughly like this:
Dim lngValue As Long
lngValue = Me.ScrollBar0
Me.Filter = "SomeField=" & lngValue
Me.FilterOn = True

JeffCoachman
Database16.accdb
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38755378
image
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

937 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now