Drop-down list

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a drop-down list which displays months (January to Desember). When
the user chooses a certain month, it must send the number of the month,
rather than the string month (I use this month number in a query). How do I
do this?

Thanks!
 
Rudi,

Create a two-field table called tblMonths, with fields:
M_ID (Numeric, Integer)
M_Name (Text)

and fill it with:
1 January
2 February
....
....
12 December

Then, set your combo box's properties as follows:

Tab Property Setting
Data RowSource Type Table/Query
Data Rowsource tblMonths
Data Bound Column 1
Format Column Count 2
Format Column Widths 0;1

The above settings make the combo get its values from the table, include
both fields, return the first one (bound column) and display the second
(width of the first one set to 0).

HTH,
Nikos
 
Going along with the above suggestion, you can avoid the additional table by
setting your RowSouorceType to "Values" and your RowSource to
1;January;2;February;3;March;.....;12;December

Access recognizes the fact that since you are defining a table with two
columns (because your column width property contains two width values ---
although one of them is zero), that the list of values is actual a list of
value pairs.

This is how my applications handle this situation.

Bob.
 
Or do it without a table...

Create a dropdown list with these properties:

ControlSource = [your field name]
RowSourceType = Value List
RowSource = 1;"January";2;"February";3;"March" .... ;12;"December"
ColumnCount = 2
ColumnWidths = 0;1
BoundColumn = 1
LimitToList = Yes

Hope this helps!
Later,
Philo
 
Back
Top