I have a table ("Person") with birth date information: month, day, year, all separate, because any one or more might be "unknown". I store "unknown" as a -1; for known values, I use a conventional encoding (jan = 1, feb = 2, etc.).
I have a form for the "Person" table that lets me enter data for a person.
I want the user to enter the birth date information on the form. If I just put up a text-box for the "month" field, it says either "-1" or "6" (for June), etc. That means that the user has to know that "-1" means "unknown", etc., which is disgusting. It also means that the user can enter "13" for the month, and I have to check it via validation, etc.
What I'd like to have is a dropdown that has the following on it:
Unknown
Jan
Feb
Mar
...
Dec
1
2
3
...
12
so that the user can select any one of these, either with the mouse, or by typing (some users like month-names, some like numbers!), but can ONLY select one of these.
My thought was to have a linked table, MonthDictionary, that looks like this:
Name value
Unknown -1
Jan 1
Feb 2
...
1 1
2 2
...
12 12
where the "name" field is a String, and the value field is a Number.
What I need:
1. To use the MonthDictionary to populate the drop-down menu
2. To make the user's selection end up in the "Month" field of the Person table record.
What I can't figure out:
* should I make a "relationship" between "month" and "month dictionary" in the "relationships" for the database? If so, I assume it should be one-to-many [one 'month dictionary' item corresponds to the months of MANY people's birth].
* How do I get the selected month-dictionary-name to generate an associated month that gets entered into the "month" field of the person?
* How to I make the field controlled by the drop-down allow "selection by typing" (so that if the user types "Ja" s/he gets "January"), but NOT allow anything except choices that are in the drop-down list?
Thanks in advance for any help you can give.
--John
I have a form for the "Person" table that lets me enter data for a person.
I want the user to enter the birth date information on the form. If I just put up a text-box for the "month" field, it says either "-1" or "6" (for June), etc. That means that the user has to know that "-1" means "unknown", etc., which is disgusting. It also means that the user can enter "13" for the month, and I have to check it via validation, etc.
What I'd like to have is a dropdown that has the following on it:
Unknown
Jan
Feb
Mar
...
Dec
1
2
3
...
12
so that the user can select any one of these, either with the mouse, or by typing (some users like month-names, some like numbers!), but can ONLY select one of these.
My thought was to have a linked table, MonthDictionary, that looks like this:
Name value
Unknown -1
Jan 1
Feb 2
...
1 1
2 2
...
12 12
where the "name" field is a String, and the value field is a Number.
What I need:
1. To use the MonthDictionary to populate the drop-down menu
2. To make the user's selection end up in the "Month" field of the Person table record.
What I can't figure out:
* should I make a "relationship" between "month" and "month dictionary" in the "relationships" for the database? If so, I assume it should be one-to-many [one 'month dictionary' item corresponds to the months of MANY people's birth].
* How do I get the selected month-dictionary-name to generate an associated month that gets entered into the "month" field of the person?
* How to I make the field controlled by the drop-down allow "selection by typing" (so that if the user types "Ja" s/he gets "January"), but NOT allow anything except choices that are in the drop-down list?
Thanks in advance for any help you can give.
--John