Y
yan
I have problem to pass the following sql statement from VB
to MS access, I use ADO Microsoft.Jet.OLEDB.4.0, it give
me error message
Run-time error '-2147467259(80004005)':
Method 'Open of object _Recordset failed
This is Sql statement:
SELECT o.AccountNo, tblCustomers.AccountName AS
[AccountName], tblCustomers.telephone as [phone],
tblCustomers.contact as [contact],Sum(o.RemainingDue) AS
TotalDue,
(( select sum(tblAROpenInvoices.RemainingDue) from
tblAROpenInvoices where tblAROpenInvoices.Datedue > date
() and tblAROpenInvoices.accountno = o.accountno )) AS
Deferred,
((select sum( tblAROpenInvoices.RemainingDue) from
tblAROpenInvoices where datedue <= date() and
tblAROpenInvoices.accountno = o.accountno )) AS [DueNow],
((select sum( tblAROpenInvoices.RemainingDue) from
tblAROpenInvoices where datedue <= date() and datedue >
( date() - 30) and tblAROpenInvoices.accountno =
o.accountno )) AS [Current],
((select sum( tblAROpenInvoices.RemainingDue) from
tblAROpenInvoices where datedue <= ( date() - 30) and
(datedue > date() - 60)and tblAROpenInvoices.accountno =
o.accountno )) AS age_day,
((select sum( tblAROpenInvoices.RemainingDue) from
tblAROpenInvoices where datedue <= ( date() - 60) and
(datedue > date() - 90) and tblAROpenInvoices.accountno =
o.accountno )) AS 2age_day,
((select sum( tblAROpenInvoices.RemainingDue) from
tblAROpenInvoices where datedue <= ( date() - 90) and
(datedue > date() - 120) and tblAROpenInvoices.accountno =
o.accountno )) AS 3age_day,
((select sum( tblAROpenInvoices.RemainingDue) from
tblAROpenInvoices where datedue <= ( date() - 120) and
tblAROpenInvoices.accountno = o.accountno )) AS 4age_day
FROM tblAROpenInvoices AS o INNER JOIN tblCustomers ON
o.AccountNo = tblCustomers.AccountNo GROUP BY
o.AccountNo,tblCustomers.AccountName,tblCustomers.telephone
,tblCustomers.contact
Thank you
to MS access, I use ADO Microsoft.Jet.OLEDB.4.0, it give
me error message
Run-time error '-2147467259(80004005)':
Method 'Open of object _Recordset failed
This is Sql statement:
SELECT o.AccountNo, tblCustomers.AccountName AS
[AccountName], tblCustomers.telephone as [phone],
tblCustomers.contact as [contact],Sum(o.RemainingDue) AS
TotalDue,
(( select sum(tblAROpenInvoices.RemainingDue) from
tblAROpenInvoices where tblAROpenInvoices.Datedue > date
() and tblAROpenInvoices.accountno = o.accountno )) AS
Deferred,
((select sum( tblAROpenInvoices.RemainingDue) from
tblAROpenInvoices where datedue <= date() and
tblAROpenInvoices.accountno = o.accountno )) AS [DueNow],
((select sum( tblAROpenInvoices.RemainingDue) from
tblAROpenInvoices where datedue <= date() and datedue >
( date() - 30) and tblAROpenInvoices.accountno =
o.accountno )) AS [Current],
((select sum( tblAROpenInvoices.RemainingDue) from
tblAROpenInvoices where datedue <= ( date() - 30) and
(datedue > date() - 60)and tblAROpenInvoices.accountno =
o.accountno )) AS age_day,
((select sum( tblAROpenInvoices.RemainingDue) from
tblAROpenInvoices where datedue <= ( date() - 60) and
(datedue > date() - 90) and tblAROpenInvoices.accountno =
o.accountno )) AS 2age_day,
((select sum( tblAROpenInvoices.RemainingDue) from
tblAROpenInvoices where datedue <= ( date() - 90) and
(datedue > date() - 120) and tblAROpenInvoices.accountno =
o.accountno )) AS 3age_day,
((select sum( tblAROpenInvoices.RemainingDue) from
tblAROpenInvoices where datedue <= ( date() - 120) and
tblAROpenInvoices.accountno = o.accountno )) AS 4age_day
FROM tblAROpenInvoices AS o INNER JOIN tblCustomers ON
o.AccountNo = tblCustomers.AccountNo GROUP BY
o.AccountNo,tblCustomers.AccountName,tblCustomers.telephone
,tblCustomers.contact
Thank you