Formatting combo default values

  • Thread starter Thread starter Trisha
  • Start date Start date
T

Trisha

I have a table field of type text which contains 3 digit
numbers. It is important that leading zeros are there. The
format property of the field is set to 000. Then there's a
corresponding combo on a form, which I programmed to
display ItemData(0):

cboX.DefaultValue = cboX.ItemData(0)

It displays the leading zeros correctly in the drop down
list, but does not display them in the default value. I
tried
cboX.DefaultValue = Format(cboX.ItemData(0),"000")
but still no leading zeros. I also tried Format() in the
SELECT statement for the recordsource, but same behavior.
Setting the combo format property to "000" didn't work
either.
Any ideas?
TIA
Trisha
 
Trisha,

This may not answer your question, but if you changed
the format of your table fields you are dealing with to be
text field types, and in your form design use "000" as the
defaultvalue property of your combo form control, the
things will happen that you are referring to. The figures
that have 000 likeness such as 001 and 002 will hold their
zeros if the field you are dealing with is changed to a
text field. This holds true for both in the field you use
from the source for your combobox choices and the field
source that is actually assigned to the combobox. If you
sort upon the field, the numbers will happen as 001, 002,
003, 004 and so on as normal numbers do. I tried these
things on a small table tonight and they acted very
similar to what you described you wanted.

This information may not be exactly what you need,
but I hope it helps you understand a possibility of how
you may deal with your situation.

Good night,

Casey
 
First thanks for replying!
The original field in the table is already of type text.
The thing is, I can't set the default value of the combo
to "000" because it will be overridden anyway: This combo
is requeried when another combo changes. They are 1-1, so
whenever the first changes, the second requeries to only
one value. What I want to do is set its default value to
ItemData(0) [the only value it requeries to].
If I do that, the leading zeros only show in the drop down
list.
I found a work-around though: I set the value property
instead of the defaultvalue, and that works.

Thanks a lot for your time and help!
Trisha
 
Back
Top