Question

So I have a list box that displays averages in a table like format from a crossyab query. It's just what I need the query is right, there is just one thing. I had to set the field properties in the query as format: standard..decimal:2. Which is exactly what I needed. However..the list box will not pick up on this.

First I typed the crosstab sql into the list box's properties....and then I ran into this problem. So then I actually just created the query object, saved it and set that as the rowsource for the list box. Still won't work....when I open the query it is the correct format.

So is there a way to further format a text box? Is there a way tell it to limit decimal places to one or two on returned values?

Thanks!

Was it helpful?

Solution

Try the Format function in your query to transform your numerical values to formatted strings. Here is a sample I copied from the Immediate Window:

? Format(-.2345,"###,###,##0.##")
-0.23

Edit: Here is an example using the Format function in a query.

SELECT Format(num_field, "###,###,##0.##") AS two_decimals
FROM MyTable;

Try a similar approach using your saved crosstab query in place of MyTable.

OTHER TIPS

Your listbox object has a Format property of it's own. I would suggest entering "#,###.##". This will display the data with a comma (if needed) and 2 decimal places.

EDIT: Whoops. I was thinking of a ComboBox control, not a ListBox Control. By way of apology, please accept a 20% discount off this advice.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top