473,398 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Age Ranges

Hey guys, have 2 issues I can't seem to find the answer to.

1. I have combo boxes on a form that filter a table via a query. One of the fields contains clients ages. I need a combo box to display age groups (under 18, 19-25, 26-35 etc.) and filter the table accordingly but can't seem to find a way to group the individual ages into these categories.

2. Optional ComboBox Filtering

Thanks in advance for any help.
Aug 1 '10 #1
2 1895
Delerna
1,134 Expert 1GB
1
You need a calculated field in the query that the form is bound to
Expand|Select|Wrap|Line Numbers
  1. select iif(age<18,"Under 18",
  2.           iif(age>17 and age<26,"19-25",
  3.           iif(age>25 and age<36,"26-35","etc"))),otherFields
  4. From theTable
Now you can use the selected value in the combobox as a criteria for that field.


A neater way if your age groupings allow for it would be to do something like

take the integer of the age divided by 5 to represent the age group
...
...
13/5= 2
14/5= 2
15/5= 3
16/5= 3
17/5= 3
18/5= 3
19/5= 3
20/5= 4
21/5= 4
...
...

Now your combobox needs two fields from a table or query
Expand|Select|Wrap|Line Numbers
  1. Group  Display
  2. 3       15-19
  3. 4       20-24
  4. 5       25-19
  5.  
and you use the group from the combo
as a criteria for the int(age/5) field
Aug 2 '10 #2
NeoPa
32,556 Expert Mod 16PB
If you build your ComboBox to have multiple columns then you can build a filter from the values of the respective lower- and upper-end columns using the format :
Expand|Select|Wrap|Line Numbers
  1. [FIELD] Between {LowerVal} And {UpperVal}
Aug 2 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: vv | last post by:
Hi All, I'm a newbie in databases..and I'm looking for answers for a few questions... Any help is appreciated! 1.What do you mean by importing a databse? 2.Is it possible to import Sybase databse...
1
by: jason | last post by:
Hello everyone, I have some general questions about the DataTable object, and how it works. Moderately new to C#, I have plenty of texts describing the language, but not so much to reference...
3
by: windandwaves | last post by:
Hi Folk I have been asked to create an e-commerce website, where we need to connect to an SQL database. The database is used to run their POS in several branches. As this database is on the...
2
by: clinttoris | last post by:
Hello, If someone could help me it would be appreciated as I am not having much luck. I'm struggling with my asp code and have some questions relating to asp and oracle database. First...
0
by: softwareakash | last post by:
Hi all here is a cool Interview Questions database for dot net http://mstechinterviews.blogspot.com or http://www.mstechinterviews.blogspot.com Regards Akash
0
by: connectrajesh | last post by:
INTERVIEWINFO.NET http://www.interviewinfo.net FREE WEB SITE AND SERVICE FOR JOB SEEKERS /FRESH GRADUATES NO ADVERTISEMENT
4
by: Drew | last post by:
I posted this to the asp.db group, but it doesn't look like there is much activity on there, also I noticed that there are a bunch of posts on here pertaining to database and asp. Sorry for...
0
by: ev00l | last post by:
Hey, this is my first time posting something on usenet, so plz be kind and mannered. Q1: I made a project where i get some information from a database, and populate them into a datagridview....
0
MrMancunian
by: MrMancunian | last post by:
How to create a database connection without using wizards Introduction I've seen a lot of questions on the net about getting data from, and saving data to databases. Here's a little insight how...
7
mb60
by: mb60 | last post by:
sir In my database I have one column for question. Four columns are meant for options 1,2,3,4. The 5th column is YES/NO column. The answers for the questions are entered into 5th column by a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.