|
|
I have the results of 2 queries that I want put on 1 form, my questions are; can I do that, what is the correct type of display device, should I be using a “list Boxâ€, a “Sub formâ€, Tab Control? I’m using 2 list boxes, the first one works, the second does not format the decimal places correctly, the query is correct (2) but the list box shows 54.4554655 and there is no control in properties for the decimal places on the list box. That leads me to believe I’m not doing this correctly
Thank You NotGood[ at ]All
|
|
Try the Format function in the query or SQL statement for your list box:
SELECT ID, Field2, Format([NumberField],"#.##") AS Expr1 FROM tblMyData; -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com
"NotGood[ at ]All" <NotGoodAll[ at ]discussions.microsoft.com> wrote in message news:0EA7C400-B3B1-4B2B-A169-265D945BBD8C[ at ]microsoft.com...
[Quoted Text] >I have the results of 2 queries that I want put on 1 form, my questions >are; > can I do that, what is the correct type of display device, should I be > using > a "list Box", a "Sub form", Tab Control? I'm using 2 list boxes, the > first > one works, the second does not format the decimal places correctly, the > query > is correct (2) but the list box shows 54.4554655 and there is no control > in > properties for the decimal places on the list box. That leads me to > believe > I'm not doing this correctly > > Thank You > NotGood[ at ]All
|
|
Arvin, Hi. Thank you for your response. I played with it but could not get it right. Would you take a look please??
SELECT [qryPart1-AvgTime].FiledWith AS [Filed With], format(Avg([qryPart1-AvgTime]),Time,"#.##") AS [Time] -- NotGood[ at ]All
"Arvin Meyer [MVP]" wrote:
[Quoted Text] > Try the Format function in the query or SQL statement for your list box: > > SELECT ID, Field2, Format([NumberField],"#.##") AS Expr1 > FROM tblMyData; > -- > Arvin Meyer, MCP, MVP > http://www.datastrat.com> http://www.mvps.org/access> http://www.accessmvp.com> > "NotGood[ at ]All" <NotGoodAll[ at ]discussions.microsoft.com> wrote in message > news:0EA7C400-B3B1-4B2B-A169-265D945BBD8C[ at ]microsoft.com... > >I have the results of 2 queries that I want put on 1 form, my questions > >are; > > can I do that, what is the correct type of display device, should I be > > using > > a "list Box", a "Sub form", Tab Control? I'm using 2 list boxes, the > > first > > one works, the second does not format the decimal places correctly, the > > query > > is correct (2) but the list box shows 54.4554655 and there is no control > > in > > properties for the decimal places on the list box. That leads me to > > believe > > I'm not doing this correctly > > > > Thank You > > NotGood[ at ]All > > >
|
|
On Wed, 31 Dec 2008 08:30:09 -0800, NotGood[ at ]All <NotGoodAll[ at ]discussions.microsoft.com> wrote:
[Quoted Text] >Arvin, Hi. Thank you for your response. I played with it but could not get >it right. Would you take a look please?? > >SELECT [qryPart1-AvgTime].FiledWith AS [Filed With], >format(Avg([qryPart1-AvgTime]),Time,"#.##") AS [Time]
Several things wrong here. You're trying to average the name of a query - you can't average "a query", it might have 255 fields and millions of rows. You can average *A FIELD* in a query, but you need to specify the fieldname:
Avg([qryPart1-AvgTime].[fieldname])
Secondly, you're using both Time and #.## as formats. You just need to specify *one* format - either a builtin predefined one such as "Time", or a format string such as "#.##", not both.
Thirdly, using the reserved word Time as a fieldname will be the source of all sorts of problems. Choose some other name for the field. --
John W. Vinson [MVP]
|
|
|