开发者

Access SQL: solving error 3612?

开发者 https://www.devze.com 2023-02-13 05:20 出处:网络
I\'m trying to create a report on MS Access. The query originating the report is the following: SELECT t1.[ORDER], t1.[HOURS], T1.[HOURS]/(SELECT COUNT(*)

I'm trying to create a report on MS Access. The query originating the report is the following:

SELECT t1.[ORDER], t1.[HOURS], T1.[HOURS]/(SELECT COUNT(*) 
FROM T2 t2 
WHERE CStr(t1.[ORDER]) = CStr(t2.[ORDER])) as Espr1 FROM T1;

An example of data tables are:

T1.[ORDER] | T1.[HOURS]

1 | 100

1 | 100

2 | 300

2 | 300

2 | 300

T2.[ORDER] | T2.[HOURS]

1 | 100

1 | 100

2 | 300

2 | 300

2 | 300

T1.[ORDER] and T1.[HOURS] are integer types. T2.[ORDER] and T2.[HOURS] are string types (please, don't ask!)

The query is executed correctly. It creates an additional column Espr1 containing the partition of the T1.HOURS (or T2.HOURS) depending on the count of lines having the same ORDER value.

For example:

[ORDER] | [HOURS] | [Espr1]

1 | 100 | 50

1 | 100 | 50

2 | 300 | 100

2 | 300 | 100

2 | 300 | 100

But when I create a text box in the report with the the following source:

 = DSum([Espr1])

MS Access give me the error 3612, but I do not declares any GROUP BY clausole!

Someone of you, experienced programmers have idea how workaround this error?


Others have the same problem (see this and this), but with no soluti开发者_如何学JAVAons...


Wupps... the answer was in one of those links specified in the question. It is necessary to create another query based which specify in the FROM clausole the query above.

That's it. Thanks MS...

0

精彩评论

暂无评论...
验证码 换一张
取 消