A
Acie
Hi,
I have a query which is basically a left join of two tables with a few iif
statements, and it returns the entire lefthanded table(14,000 rows) when I
run it in Access directly. However, that same query when I run it with DAO3.6
in MS Access VBA returns only 593 records. First time this has ever happened.
I use the rst.getrows() function to retrieve the data. Sample code is below..
sql code..
sql = "SELECT Equity.SEC_ID, Equity.ID_ISIN, Equity.ID_CUSIP,
Equity.ID_SEDOL1, Equity.ID_VALOREN, "
sql = sql & "IIf(IsNumeric([eqy_sh_out]),[eqy_sh_out]*1000000,[eqy_sh_out])
AS converted_eqy_sh_out, "
sql = sql & "Equity.CNTRY_OF_INCORPORATION, Equity.CPN, Equity.CPN_TYPE,
Equity.CRNCY, Equity.DEFAULTED, "
sql = sql & "Equity.ADR_ADR_PER_SH, Equity.DVD_CRNCY, Equity.MTG_FACTOR,
Equity.MOST_RECENT_REPORTED_FACTOR, "
sql = sql & "Equity.SINKING_FUND_FACTOR, Equity.MTG_FACTOR_DT,
Equity.NXT_FACTOR_DT, Equity.ISSUER_INDUSTRY, "
sql = sql & "Equity.INDUSTRY_GROUP, Equity.ISSUE_DT, Equity.ISSUER,
Equity.MARKET_ISSUE, Equity.MATURITY, "
sql = sql & "IIf(IsNumeric([price]),IIf([crncy]<> " & quote & "USD" & quote
& ",[amt_issued]*[exchange_rate],[amt_issued]), "
sql = sql & "[amt_issued]) AS converted_amt_issued, Equity.MTG_ORIG_AMT,
Equity.MTG_COLLAT_TYPE, "
sql = sql & "Equity.SECURITY_DES, Equity.SECURITY_TYPE,
Equity.SECURITY_TYPE2, Equity.LEAD_MGR, "
sql = sql & "Equity.COUNTRY_GUARANTOR, Equity.ISO_COUNTRY_GUARANTOR,
IIf(IsNumeric([price]), "
sql = sql & "IIf([crncy]<>" & quote & "USD" & quote &
",[price]*[exchange_rate],[price]),[price]) AS converted_price, "
sql = sql & "Equity.EQY_DVD_HIST_ALL, Null AS INT_ACC, Null AS
Amt_outstanding, " & quote & Get_survey_year & quote & " AS survey_date "
sql = sql & "FROM Equity LEFT JOIN CLTBS_CL_CURRENCIES ON Equity.CRNCY =
CLTBS_CL_CURRENCIES.CODE;"
and then the command to retieve the data....
Set rst = dbs.OpenRecordset(sql)
found_data = False
If Not rst.BOF And Not rst.EOF Then
vardata2 = rst.GetRows(200000)
found_data = True
End If
rst.Close
vardata2 (a variant) contains only 593 rows of data, instead of about 14,000
records.
Any ideas?
thanks.
I have a query which is basically a left join of two tables with a few iif
statements, and it returns the entire lefthanded table(14,000 rows) when I
run it in Access directly. However, that same query when I run it with DAO3.6
in MS Access VBA returns only 593 records. First time this has ever happened.
I use the rst.getrows() function to retrieve the data. Sample code is below..
sql code..
sql = "SELECT Equity.SEC_ID, Equity.ID_ISIN, Equity.ID_CUSIP,
Equity.ID_SEDOL1, Equity.ID_VALOREN, "
sql = sql & "IIf(IsNumeric([eqy_sh_out]),[eqy_sh_out]*1000000,[eqy_sh_out])
AS converted_eqy_sh_out, "
sql = sql & "Equity.CNTRY_OF_INCORPORATION, Equity.CPN, Equity.CPN_TYPE,
Equity.CRNCY, Equity.DEFAULTED, "
sql = sql & "Equity.ADR_ADR_PER_SH, Equity.DVD_CRNCY, Equity.MTG_FACTOR,
Equity.MOST_RECENT_REPORTED_FACTOR, "
sql = sql & "Equity.SINKING_FUND_FACTOR, Equity.MTG_FACTOR_DT,
Equity.NXT_FACTOR_DT, Equity.ISSUER_INDUSTRY, "
sql = sql & "Equity.INDUSTRY_GROUP, Equity.ISSUE_DT, Equity.ISSUER,
Equity.MARKET_ISSUE, Equity.MATURITY, "
sql = sql & "IIf(IsNumeric([price]),IIf([crncy]<> " & quote & "USD" & quote
& ",[amt_issued]*[exchange_rate],[amt_issued]), "
sql = sql & "[amt_issued]) AS converted_amt_issued, Equity.MTG_ORIG_AMT,
Equity.MTG_COLLAT_TYPE, "
sql = sql & "Equity.SECURITY_DES, Equity.SECURITY_TYPE,
Equity.SECURITY_TYPE2, Equity.LEAD_MGR, "
sql = sql & "Equity.COUNTRY_GUARANTOR, Equity.ISO_COUNTRY_GUARANTOR,
IIf(IsNumeric([price]), "
sql = sql & "IIf([crncy]<>" & quote & "USD" & quote &
",[price]*[exchange_rate],[price]),[price]) AS converted_price, "
sql = sql & "Equity.EQY_DVD_HIST_ALL, Null AS INT_ACC, Null AS
Amt_outstanding, " & quote & Get_survey_year & quote & " AS survey_date "
sql = sql & "FROM Equity LEFT JOIN CLTBS_CL_CURRENCIES ON Equity.CRNCY =
CLTBS_CL_CURRENCIES.CODE;"
and then the command to retieve the data....
Set rst = dbs.OpenRecordset(sql)
found_data = False
If Not rst.BOF And Not rst.EOF Then
vardata2 = rst.GetRows(200000)
found_data = True
End If
rst.Close
vardata2 (a variant) contains only 593 rows of data, instead of about 14,000
records.
Any ideas?
thanks.