Number does not display correctly

  • Thread starter Thread starter AHopper
  • Start date Start date
A

AHopper

I created a number using a "JobNumber", today's date and
the "StartTime" using the following: (JobNumber is on the
open form, StartTime is located by a DLookUp)

Dim Batch As Double
Batch = Format(Me.JobNumber, "0000") & Format
(Now, "mmddyy") & Format(StartTime, "hh")

The number created today is 018401130407 (Job 0184, Date
01 13 04 Time 07)
I stored the number in the database field "BatchNumber"
(field size is set for double, format 000000000000 and it
appears to be alright (I copy and pasted the number
directly from the database field to this message).

I now want to use the number in an unbound combo box as a
selection. The number appears correctly in the drop down
selection. I have the Bound Column set for this number,
however, when I select the number only 0184 displays in
the combo box and there is no error message.I have tried
no format for the combo box, standard format, general
number format, 000000000000 format and the display remains
the same.

Can I create a number that is usable this way?

If so how can I get it to fully display the number?

Can I refer to it and use it other places in the database?

Thank you in advance for your help.

Allan
 
The number created today is 018401130407 (Job 0184, Date
01 13 04 Time 07)
I stored the number in the database field "BatchNumber"
(field size is set for double, format 000000000000 and it
appears to be alright (I copy and pasted the number
directly from the database field to this message).

Use a Text type rather than a Double. Doubles have roundoff error and
will display in scientific notation. You'll never be doing math with
this batch number - just treat it as a Text field which happens to
consist of the text characters 0 through 9.
 
John, Sorry for not being clear. The number stores in the
table's field correctly, the problem occurs when I try to
use it in the combo box as a selection. After it is
selected it displays in the (test box part of the) combo
box as 0184. However, I discovered that if I leave the
number in column 1 and have column 1 as the bound column
the number will display in the (text box part of the)
combo box after it is selected as 018401130407, which is
correct. Why does it have to be in column one to display
correctly?

Allan
 
John, Sorry for not being clear. The number stores in the
table's field correctly, the problem occurs when I try to
use it in the combo box as a selection. After it is
selected it displays in the (test box part of the) combo
box as 0184. However, I discovered that if I leave the
number in column 1 and have column 1 as the bound column
the number will display in the (text box part of the)
combo box after it is selected as 018401130407, which is
correct. Why does it have to be in column one to display
correctly?

A Combo has a number of interacting properties:

- The Column Count specifies how many columns
- The RowSource query specifies what goes in those columns
- The Control Source specifies what feild (if any) the selected value
will be stored into
- The Bound Column defines which of these columns is stored in the
Control Source
- The Column Widths specifies how wide (in inches or centimeters) each
column is. A column of width 0 will be there as far as Access is
concerned but will not be visible to the user; often you'll set the
width of the bound column to zero

What is visible when the combo is not dropped down is the first
non-zero width column. You can rearrange the fields in the query, and
the above properties, so that the computer sees one field, the user
sees some other field, and both end up satisfied!
 
John, the interesting thing about this is that I set the
Column width the same when I have the number 018401130407
in column one and column three. In both cases the full
number is visible to the user in the drop down list. When
the number is in column 1 and column 1 is the bound column
the full number 018401130407 is visible after the
selection is made and the drop list is closed. When I move
the number to column 3 (same width as when it was in
column one) and column 3 is the bound column only 0184 is
visible after the selection is made and the drop list is
closed. I can live with the number being in column one,
however, I don't understand what make the difference.

Thanks again for your help.
Allan
 
John, the interesting thing about this is that I set the
Column width the same when I have the number 018401130407
in column one and column three. In both cases the full
number is visible to the user in the drop down list. When
the number is in column 1 and column 1 is the bound column
the full number 018401130407 is visible after the
selection is made and the drop list is closed. When I move
the number to column 3 (same width as when it was in
column one) and column 3 is the bound column only 0184 is
visible after the selection is made and the drop list is
closed. I can live with the number being in column one,
however, I don't understand what make the difference.

Please post the actual ColumnWidths property of the combo, along with
the SQL of the RowSource query (and perhaps some sample data).

Could the 0184 just be the leftmost fraction of an inch of the big
number, with the rest of the number truncated?

Again... what you will see when the combo is closed is (whatever there
is room for) in the first non-zero width column. It makes no differnce
which column is bound.
 
Back
Top