How can I get data to display as 1.00 instead of 1 ....?

  • Thread starter Thread starter Kelvin Beaton
  • Start date Start date
K

Kelvin Beaton

I'm using Access as the front end and MS SQL on the backend.
I have a combo box that pulls from an sql table called tbl_activitytime.

The data type in SQL is float currently, and my list looks like 1, 1.25,
1.5, but I want it to look like 1.00, 1.25, 1.50......

I tried formatting the combo box to #.##, I also choose 2 decimal places and
entered an input mask of #.## but no luck

So what's the right way to do this?

Thanks

Kelvin
 
Is the RowSource for the combo box a pass-through query, or is it a query
against a linked table?

If it's a query against a linked table, you can use the Format function in
your query: rather than SELECT Field1 FROM Table, you'd use SELECT
Format(Field1, "#.00") FROM Table.

If it's a pass-through query, I'm sure something equivalent is available in
T-SQL, but I don't have access to BOL at the moment.
 
Perfect, thanks!




Douglas J. Steele said:
Is the RowSource for the combo box a pass-through query, or is it a query
against a linked table?

If it's a query against a linked table, you can use the Format function in
your query: rather than SELECT Field1 FROM Table, you'd use SELECT
Format(Field1, "#.00") FROM Table.

If it's a pass-through query, I'm sure something equivalent is available
in T-SQL, but I don't have access to BOL at the moment.
 
If it's a query against a linked table, you can use the Format function in
your query: rather than SELECT Field1 FROM Table, you'd use SELECT
Format(Field1, "#.00") FROM Table.

If it's a pass-through query, I'm sure something equivalent is available in
T-SQL, but I don't have access to BOL at the moment.

Doubtful :) SQL is a data management language. T-SQL (SQL Server's
implementation of SQL) has no 'format' function either, AFAIK.
Formatting is supposed to be done in the front end in a tiered
architecture.

Jamie.

--
 
Jamie Collins said:
Doubtful :) SQL is a data management language. T-SQL (SQL Server's
implementation of SQL) has no 'format' function either, AFAIK.
Formatting is supposed to be done in the front end in a tiered
architecture.

I was thinking in terms of something like using CAST to a Decimal type with
two decimal figures, but I have no idea whether that would work.
 
I was thinking in terms of something like using CAST to a Decimal type with
two decimal figures, but I have no idea whether that would work.

I was thinking it should have been a DECIMAL(n ,2) column to begin
with :)

Jamie.

--
 
Back
Top