Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Created Ranges for Combobox Values

Status
Not open for further replies.

JohnEMcCarthy

Programmer
Jun 15, 2007
3
0
0
US
Right now I have comboboxes with values that range from 1-12. Instead of having each distinct value display, I want to group them in ranges (Low, Medium and High). When a user clicks the combobox they will see Low, Medium and High, and each will contain a range of values. Because the values 1-12 are not static and may change with newly imported data, I want to classify the ranges Low, Medium and High by every 33.3%. In other words, whatever digits fall in the bottom 33.3% will be assigned "Low," the middle 33.3% will be assigned "Medium," etc.

Does anyone have any ideas?

Thank you warmly for reading, and for your time and consideration.
 
Change the RowSource Type to Value List. Then in the RowSouce box, type on Low;Medium;High or whatever order you want.
Now I'm going to assume your range will always start at 1 and increases by 1. eg. 1-13, 1-22, etc.

On the AfterUpdate event of the combobox, Use the Dmax function to find the highest integer in the field keeping the numbers 1-12, for example. Then test the value selected - you can use a Select Case for this. Then for a match of Low, divide by 3, medium divide by 2/3, high is just high. You now have the end points for the ranges. You can now create a variable, eg. mediumvar = ">4 AND <=8", and pass this to a query.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top