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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validation in drop down lists 1

Status
Not open for further replies.

CatahoulaHound

Technical User
Feb 26, 2001
47
US
Greetings to all. I have a form with 4 drop down lists that have codes for specific sports in them. I want to be able to limit what sport can be selected based on the "year of birth" of the child that is being registered.(Some kids are too young to participate in some sports)Can someone please explain how I can do this. I'm not good with VB but I sure can copy well. All suggestions are very much appreciated.
Pat
 
The slickest way is to dynamically generate the list available in those controls taking into account the year of birth of the child. It prevents the user from even seeing items that they are not allowed to choose.

Just a general idea of how to go about it: (1) reference the year of birth field as a criteria in each of the four control's recordsource queries, and (2) make sure that the controls' are requeried in the "on current" event of the form and probably also in the "on enter" event of the control to ensure that the query they're using has actually referenced the existing date of birth field for the current child.

If it's done that way, I foresee possible problems down the road when a child has an item entered that is no longer appropriate for its age group. There are ways to deal with that, though.
-- Herb
 
Thanks Herb:
You're right. That is one heck of a slick way to do it. Now if I can just get it done. I will work in it tomorrow so watch for my "HELP I DON'T KNOW WHAT I'M DOING" post. Thanks for your help.
Pat
 
If you want, you can email me your .mdb and I'll put it in, or just send me an email and I'll send you a small sample .mdb with an example of how this works set up. -- Herb
hsitz@nwlink.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top