problems with Columns

J

Joel

The 2nd column in my combobox is numbers in a text field so i can save them
in this format "001".
Now if i have the combobox bound to the number it saves it perfectly fine in
the database (as "001").
But if I use Me!numID = Me.Column(1) it saves the number "001" as just "1".
How do I get it to save as "001"?

Thanks
 
D

Douglas J Steele

numID would have to be text in order to keep the leading zeroes: for numeric
fields, 1 and 001 are identical.

If all you care about is how it looks, you can format the field, using 000
as the format. However, that doesn't change what's actually stored.
 
J

Joel

numID is a text field. But it still wont save it in the DB as 001 if I use
the column(1) code and I need it to save this way.
 
D

David Lloyd

Joel:

One alternative is to use the Format function. For example:

Me!numID = Format(Me.Column(1), "000")


--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


The 2nd column in my combobox is numbers in a text field so i can save them
in this format "001".
Now if i have the combobox bound to the number it saves it perfectly fine in
the database (as "001").
But if I use Me!numID = Me.Column(1) it saves the number "001" as just "1".
How do I get it to save as "001"?

Thanks
 
J

Joel

Ok just found a problem with this.

For some reason Format() worked for about 1/2 of my comboboxes in the other
ones its saves a wierd # in the database thats not even on the list...

ex: Combo1 has these selections 001 002 003 004
If i select one of these it saves 001 as 01 and 002 as 21 and 003 as 31 exc..
 
J

John Vinson

Ok just found a problem with this.

For some reason Format() worked for about 1/2 of my comboboxes in the other
ones its saves a wierd # in the database thats not even on the list...

ex: Combo1 has these selections 001 002 003 004
If i select one of these it saves 001 as 01 and 002 as 21 and 003 as 31 exc..

Please post your actual code.

John W. Vinson[MVP]
 
Top