i have this sql in my vb6 program
sSQL = "SELECT [LUMBER].[INV] AS INV_NUMBER, Sum([LUMBER].[VOLUME]) AS _VOLUME, Sum([LUMBER].[TOTAL]) AS _AMOUNT, [LUMBER].[CUST] AS CUSTOMER, LUMBERD.MIL, LUMBERD.COND, LUMBERD.SPEC, LUMBERD.USD, LUMBERD.NOTE From LUMBERD Where (UCase(MonthName(Month(DATE1))) = '" & cmbMONTHS.Text & "') GROUP BY [LUMBER].[INV], [LUMBER].[CUST], LUMBERD.USD, LUMBERD.MIL, LUMBERD.COND, LUMBERD.SPEC, LUMBERD.NOTE;"
Set rstTarget = New ADODB.Recordset
rstTarget.Open sSQL, objAccessConnection, adOpenKeyset, adLockOptimistic
i am not sure what is wrong with it - it gives me empty recordset from vb6 program.
when i debug.print ssql, copy it and run in ms access work ok:
SELECT [LUMBER].[INV] AS INV_NUMBER, Sum([LUMBER].[VOLUME]) AS _VOLUME, Sum([LUMBER].[TOTAL]) AS _AMOUNT, [LUMBER].[CUST] AS CUSTOMER, LUMBERD.MIL, LUMBERD.COND, LUMBERD.SPEC, LUMBERD.USD, LUMBERD.NOTE From LUMBERD Where (UCase(MonthName(Month(DATE1))) = 'AUGUST') GROUP BY [LUMBER].[INV], [LUMBER].[CUST], LUMBERD.USD, LUMBERD.MIL, LUMBERD.COND, LUMBERD.SPEC, LUMBERD.NOTE;
INV_NUMBER _VOLUME _AMOUNT CUSTOMER MIL COND SPEC USD NOTE
001 26156 $10,462.40 TENRYU CANADA CORPORATION ROUGH GREEN FIR No
002 7340 $6,761.20 DOUBLETREE FOREST PRODUCTS LTD. ROUGH GREEN WRC No
003 11392 $15,379.20 SAWARNE LUMBER CO. LTD. ROUGH GREEN WRC No
004 3504 $6,359.76 E.R. PROBYN EXPORT LTD. ROUGH GREEN WRC No
any idea, please?
sSQL = "SELECT [LUMBER].[INV] AS INV_NUMBER, Sum([LUMBER].[VOLUME]) AS _VOLUME, Sum([LUMBER].[TOTAL]) AS _AMOUNT, [LUMBER].[CUST] AS CUSTOMER, LUMBERD.MIL, LUMBERD.COND, LUMBERD.SPEC, LUMBERD.USD, LUMBERD.NOTE From LUMBERD Where (UCase(MonthName(Month(DATE1))) = '" & cmbMONTHS.Text & "') GROUP BY [LUMBER].[INV], [LUMBER].[CUST], LUMBERD.USD, LUMBERD.MIL, LUMBERD.COND, LUMBERD.SPEC, LUMBERD.NOTE;"
Set rstTarget = New ADODB.Recordset
rstTarget.Open sSQL, objAccessConnection, adOpenKeyset, adLockOptimistic
i am not sure what is wrong with it - it gives me empty recordset from vb6 program.
when i debug.print ssql, copy it and run in ms access work ok:
SELECT [LUMBER].[INV] AS INV_NUMBER, Sum([LUMBER].[VOLUME]) AS _VOLUME, Sum([LUMBER].[TOTAL]) AS _AMOUNT, [LUMBER].[CUST] AS CUSTOMER, LUMBERD.MIL, LUMBERD.COND, LUMBERD.SPEC, LUMBERD.USD, LUMBERD.NOTE From LUMBERD Where (UCase(MonthName(Month(DATE1))) = 'AUGUST') GROUP BY [LUMBER].[INV], [LUMBER].[CUST], LUMBERD.USD, LUMBERD.MIL, LUMBERD.COND, LUMBERD.SPEC, LUMBERD.NOTE;
INV_NUMBER _VOLUME _AMOUNT CUSTOMER MIL COND SPEC USD NOTE
001 26156 $10,462.40 TENRYU CANADA CORPORATION ROUGH GREEN FIR No
002 7340 $6,761.20 DOUBLETREE FOREST PRODUCTS LTD. ROUGH GREEN WRC No
003 11392 $15,379.20 SAWARNE LUMBER CO. LTD. ROUGH GREEN WRC No
004 3504 $6,359.76 E.R. PROBYN EXPORT LTD. ROUGH GREEN WRC No
any idea, please?