我正在使用的代码:
Dim rs As New ADODB.Recordset
rs.Open "select * from QueryName", CurrentProject.Connection, adOpenDynamic, adLockReadOnly
为什么在大火中这会返回一个打开的错误?查询本身完全没问题。
查询,顺便说一句:
SELECT DISTINCT Zone.Office, ledger.representative
FROM ledger LEFT JOIN [Zone] ON ledger.branch = Zone.app_office
WHERE (((Zone.Office)<>"" And (Zone.Office) Is Not Null) AND ((ledger.representative)<>"" And (ledger.representative) Is Not Null))
UNION SELECT DISTINCT Zone.Office, ClientList.representative
FROM ClientList LEFT JOIN [Zone] ON ClientList.branch = Zone.app_office
WHERE (((Zone.Office)<>"" And (Zone.Office) Is Not Null) AND ((ClientList.representative)<>"" And (ClientList.representative) Is Not Null))
UNION SELECT DISTINCT Zone.Office, ghs.representative
FROM ghs LEFT JOIN [Zone] ON ghs.branch = Zone.app_office
WHERE (((Zone.Office)<>"" And (Zone.Office) Is Not Null) AND ((ghs.representative)<>"" And (ghs.representative) Is Not Null))
UNION SELECT DISTINCT Zone.Office, Prospects.representative
FROM Prospects LEFT JOIN [Zone] ON Prospects.branch = Zone.app_office
WHERE (((Zone.Office)<>"" And (Zone.Office) Is Not Null) AND ((Prospects.representative)<>"" And (Prospects.representative) Is Not Null))