0

私は Access を初めて使用し、しばらく VB を使用していません。データベース内での作業に問題があります。誰かがここで少し光を当てることができますか? クエリとエラー:

SELECT piname, 
       SUM(cat1)    AS CatI, 
       SUM(cat2)    AS CatII, 
       SUM(cat3)    AS CatIII, 
       SUM(cat4)    AS CatIV, 
       0            AS CatV, 
       0            AS CatVI, 
       SUM(cat7)    AS CatVII, 
       SUM(cat8)    AS CatVIII, 
       SUM(cat9)    AS CatIX, 
       SUM(dbltime) AS CatIXTime, 
       0            AS CatX, 
       0            AS CatXI, 
       SUM(cat12)   AS CatXII 
FROM   [SELECT Trim(users.pilastname & ' ' & users.pifirstname) AS PIName, 
               SUM(Abs(log.chargef))                            AS Cat1, 
               SUM(Abs(log.chargeg))                            AS cat2, 
               SUM(Abs(log.chargee))                            AS cat3, 
               SUM(Abs(log.charget))                            AS cat4, 
               0                                                AS Cat7, 
               0                                                AS Cat8, 
               0                                                AS Cat9, 
               0                                                AS dblTime, 
               SUM(log.hours)                                   AS Cat12 
        FROM   log, 
               users, 
               raform 
        WHERE  LEFT(log.sampleid, 2) = users.pi 
               AND Ucase(users.location) = 'S' 
               AND raform.sampleid = log.sampleid 
               AND log.finisheddate BETWEEN #5/1/2013# AND #6/1/2013# 
               AND Ucase(machine) = 'OUT' 
        GROUP  BY Trim(users.pilastname & ' ' & users.pifirstname) 
        UNION 
        SELECT Trim(users.pilastname & ' ' & users.pifirstname), 
               0, 
               0, 
               0, 
               0, 
               Count(plab.billing), 
               0, 
               0, 
               0, 
               0 
        FROM   plab, 
               pform, 
               users, 
               userinfo 
        WHERE  userinfo.pi = users.pi 
               AND Ucase(users.location) = 'S' 
               AND plab.sampleid = pform.sampleid 
               AND plab.email = userinfo.email 
               AND plab.finisheddate BETWEEN #5/1/2013# AND #6/1/2013# 
               AND plab.finished = true 
               AND plab.billing = 1 
        GROUP  BY Trim(users.pilastname & ' ' & users.pifirstname) 
        UNION 
        SELECT Trim(users.pilastname & ' ' & users.pifirstname), 
               0, 
               0, 
               0, 
               0, 
               0, 
               Count(plab.billing), 
               0, 
               0, 
               0 
        FROM   plab, 
               pform, 
               users, 
               userinfo 
        WHERE  userinfo.pi = users.pi 
               AND Ucase(users.location) = 'S' 
               AND plab.sampleid = pform.sampleid 
               AND plab.email = userinfo.email 
               AND plab.finisheddate BETWEEN #5/1/2013# AND #6/1/2013# 
               AND plab.finished = true 
               AND plab.billing = 2 
        GROUP  BY Trim(users.pilastname & ' ' & users.pifirstname) 
        UNION 
        SELECT Trim(users.pilastname & ' ' & users.pifirstname), 
               0, 
               0, 
               0, 
               0, 
               0, 
               0, 
               0, 
               Count(plab.billing), 
               SUM(t_desa + t_zipt + t_dige + t_gel1 + t_gel2 + t_mtof 
                   + t_ftms + t_nano + t_hplc + t_data + t_anal + t_repo 
                   + t_othe) 
        FROM   plab, 
               pform, 
               users, 
               userinfo 
        WHERE  userinfo.pi = users.pi 
               AND Ucase(users.location) = 'S' 
               AND plab.sampleid = pform.sampleid 
               AND plab.email = userinfo.email 
               AND plab.finisheddate BETWEEN #5/1/2013# AND #6/1/2013# 
               AND plab.finished = true 
               AND plab.billing = 3 
        GROUP  BY Trim(users.pilastname & ' ' & users.pifirstname)]. AS grausig 
GROUP  BY piname 

SoftArtisans.ExcelTemplate.1 エラー '80020009'

トークンが何にもバインドされていないか、無効です。データ マーカーのデータ ソースが見つかりませんでした: ユーザー

4

1 に答える 1

4

すぐにわかる問題がいくつかあります。

サブクエリを使用しています。do を実行するときは、完全なクエリである必要があります。サブクエリに FROM ステートメントがありません。

また、サブクエリは括弧 () で囲む必要があります。

このサイトは、SQL ステートメントのフォーマットに非常に優れているため、表示と編集が容易になります。

于 2013-05-24T02:50:54.640 に答える