Long Int Displays With 2 Decimals?!!

  • Thread starter Thread starter MikeC
  • Start date Start date
M

MikeC

I'm having a problem with a bound combo box control in a form.

The data type of the underlying field is defined as long integer in the
table. The Format property = "Fixed". The field displays as expected when
viewed from the table.

The Format property of the combo box control is set to "Fixed" and the
Decimal Places property is set to 0.

Despite the above, the number that displays in the combo box always displays
with a decimal point followed by 2 zeroes. Example:

1234 displays as 1234.00

I even modified the query that I'm using as the rowsource so that the
field's Format property is "Fixed" and Decimal Places = 0, but this change
made no difference. Incidentally, the field displayed just fine in the
query both before *and* after this change.

I have deleted and re-created the combo box.

I have compacted and repaired the AXP database.

I have decompiled and recompiled.

I have even changed the Decimal Places property to Auto to allow Access an
opportunity to resolve the issue on its own. This idea also failed.

I have run out of ideas.

The combo box continues to display decimals. Has anyone else experienced
this issue or know a solution?
 
MikeC said:
I'm having a problem with a bound combo box control in a form.

The data type of the underlying field is defined as long integer in
the table. The Format property = "Fixed". The field displays as
expected when viewed from the table.

The Format property of the combo box control is set to "Fixed" and the
Decimal Places property is set to 0.

Despite the above, the number that displays in the combo box always
displays with a decimal point followed by 2 zeroes. Example:

1234 displays as 1234.00

I even modified the query that I'm using as the rowsource so that the
field's Format property is "Fixed" and Decimal Places = 0, but this
change made no difference. Incidentally, the field displayed just
fine in the query both before *and* after this change.

I have deleted and re-created the combo box.

I have compacted and repaired the AXP database.

I have decompiled and recompiled.

I have even changed the Decimal Places property to Auto to allow
Access an opportunity to resolve the issue on its own. This idea
also failed.

I have run out of ideas.

The combo box continues to display decimals. Has anyone else
experienced this issue or know a solution?

I'm very curious. Would you be interested in sending me a copy of the
database? If so, please cut it down to the bare minimum, including only
the elements necessary to demonstrate the problem, compact it, then zip
it to less than 1MB in size (preferably much smaller). You can send it
to the address derived by removing NO SPAM from the reply address of
this message.
 
That is an odd one. The only thing that I can think of is that maybe it has
an input mask. But, it doesn't sound like it since you say it displays
properly in the table. I'll be curious to see if Dirk is able to find what's
causing it.

-Ted Allen
 
Okay, now I've had a chance to look at your database. You've made a few
inaccurate or misleading statements, though I'm sure you didn't intend
to. See my comments inline.

MikeC said:
I'm having a problem with a bound combo box control in a form.

The data type of the underlying field is defined as long integer in
the table. The Format property = "Fixed". The field displays as
expected when viewed from the table.

This is ultimately the source of your problem. The "Fixed" format
implies decimal places by default (unless overridden by the
DecimalPlaces property. The default number of decimal places for the
"Fixed" format is specified by your operating system's Regional
Settings. On mine, and I suspect on most people's, that is 2 decimal
places.

For Long Integer, Integer, or Byte field the Format property should
usually be left blank or set to "General Number".
The Format property of the combo box control is set to "Fixed" and the
Decimal Places property is set to 0.

Despite the above, the number that displays in the combo box always
displays with a decimal point followed by 2 zeroes. Example:

1234 displays as 1234.00

This is a misleading statement. The number that displays in the text
portion of the combo box (when the combo's list isn't dropped down) does
*not* display with 2 decimal places. It is the values in the combo
boxes dropdown list that show the decimal places.
I even modified the query that I'm using as the rowsource so that the
field's Format property is "Fixed" and Decimal Places = 0, but this
change made no difference. Incidentally, the field displayed just
fine in the query both before *and* after this change.

This doesn't appear to be true. In the rowsource query, qryWorkOrder,
as you gave it to me, the field's Format property is blank and the
DecimalPlaces property is set to Auto, and the field displays with the
decimal places. Those settings, incidentally, mean that the Fixed
format defined in the table will be carried through to the query, and
the DecimalPlaces will revert to whatever is the default for the Fixed
format.

But when I change the field's Format property in the query to "General
Number", the decimal places disappear from both the query's datasheet
view and the combo box's dropdown list. Interestingly, if I leave the
Format property blank but change the DecimalPlaces property to 0, the
decimal places disappear from the query datasheet, but still appear in
the combo's dropdown list. *This* is contrary to my expectations.
Either this is a bug, or it's behavior contrary to the statements in the
help topics, or my interpretation of those statements is faulty -- but I
can't say that I've studied those topics well enough to be sure which is
the case.

Regardless, the true solution is to change the format of the field in
the table design, from "Fixed" to blank (or General Number), and set the
DecimalPlaces property to Auto. There's no point in applying a format
that implies decimal places to a type of field that can never have any.
Do that, and remove the Fixed format from anywhere else you may have
applied it to this field, and all should be well with your combo box.
 
Thanks for your help Dirk. See below comments at MC>.

Dirk Goldgar said:
Okay, now I've had a chance to look at your database. You've made a few
inaccurate or misleading statements, though I'm sure you didn't intend
to. See my comments inline.



This is ultimately the source of your problem. The "Fixed" format
implies decimal places by default (unless overridden by the
DecimalPlaces property. The default number of decimal places for the
"Fixed" format is specified by your operating system's Regional
Settings. On mine, and I suspect on most people's, that is 2 decimal
places.

MC> I see I'm still learning something new every day. I had no idea
"Fixed" implies decimals. This is good to know. I was just trying to
suppress commas!!! I'll enter a custom format instead of using the built-in
formats.
For Long Integer, Integer, or Byte field the Format property should
usually be left blank or set to "General Number".


This is a misleading statement. The number that displays in the text
portion of the combo box (when the combo's list isn't dropped down) does
*not* display with 2 decimal places. It is the values in the combo
boxes dropdown list that show the decimal places.
MC> Right. Sorry, I overlooked that detail when I wrote my original post.
This doesn't appear to be true. In the rowsource query, qryWorkOrder,
as you gave it to me, the field's Format property is blank and the
DecimalPlaces property is set to Auto, and the field displays with the
decimal places. Those settings, incidentally, mean that the Fixed
format defined in the table will be carried through to the query, and
the DecimalPlaces will revert to whatever is the default for the Fixed
format.

MC> Actually, it was true at the time I wrote the post. :-) I continued
tinkering and then saw your post offering to take a look after I had made
some changes. You received the latest version which included some changes
to the query. The problem was still reproducible, so I didn't attempt to
undo this change.
But when I change the field's Format property in the query to "General
Number", the decimal places disappear from both the query's datasheet
view and the combo box's dropdown list. Interestingly, if I leave the
Format property blank but change the DecimalPlaces property to 0, the
decimal places disappear from the query datasheet, but still appear in
the combo's dropdown list. *This* is contrary to my expectations.
Either this is a bug, or it's behavior contrary to the statements in the
help topics, or my interpretation of those statements is faulty -- but I
can't say that I've studied those topics well enough to be sure which is
the case.

Regardless, the true solution is to change the format of the field in
the table design, from "Fixed" to blank (or General Number), and set the
DecimalPlaces property to Auto. There's no point in applying a format
that implies decimal places to a type of field that can never have any.
Do that, and remove the Fixed format from anywhere else you may have
applied it to this field, and all should be well with your combo box.

MC> Thanks again.
 
On second thought....

There was never any need to suppress commas, so I didn't and still don't
need to apply any special formatting to this field. That idea was a
solution in search of a problem.

Yes, create the long integer field and do nothing more. I like that even
better. ;-)

Thanks again.
 
Back
Top