Combo box, column(x) and format

C

Chris

I use Column(x) to retrieve an item from a combo box selection, via an after
update event.

Example: me.mycontrol = cbo.column(3)

The column is formatted correctly for dates, etc., but my "mycontrol" does
not carrry the format. Ok...so I format that control, even trying input
mask. No joy.

How do I format "mycontrol" after retrieving from a combo box?
 
K

Klatuu

Use the Format property for mycontrol is the format is always the same. If,
on the other hand, the format for different selections from cbo.column(3) can
have different formats, you will need a way to know what the format should
be. Here is a trick that should work. Add another column to your cbo that
has the format mask in it. Make the column width 0 so the user will not see
it. Then in the after update event:

Me.mycontrol.format = me.cbo.column(4)

The above will work provided the row source for your combo is a value list.
If it is a table or query, it will be harder to do. You may have to add a
field to your table or query that will tell which format to use. Like for
dates use 0 for currency use 1 for phone number use 2. Then in the after
update, use a Select Case statement to choose the correct format.
 
W

Wayne Morgan

Try using Format() in the equation:

Example:
me.mycontrol = Format(cbo.column(3), "Short Date")
 
C

Chris

That works. What a handy tool, too. I do appreciate it.
--
Thanks for your help,
Chris


Wayne Morgan said:
Try using Format() in the equation:

Example:
me.mycontrol = Format(cbo.column(3), "Short Date")
 
Top