Multiple Sources

N

NotGood@All

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@All
 
A

Arvin Meyer [MVP]

Try the Format function in the query or SQL statement for your list box:

SELECT ID, Field2, Format([NumberField],"#.##") AS Expr1
FROM tblMyData;
 
N

NotGood@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@All


Arvin Meyer said:
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@All said:
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@All
 
J

John W. Vinson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top