G
Guest
Hi, I'm back,
Building an SQL string for an ADODB recordset:
. . .
Dim dteDate1, dteDate2 As Date
cnn1.Open strSourceDB
dteDate1 = #7/1/2004#
dteDate2 = #7/31/2004#
strWhere = "WHERE (((tblTransactions.TransactionDate) >= " & #7/1/2004# _
& " And (tblTransactions.TransactionDate) < " & "#7/31/2004#" _
& "))"
'strWhere = "WHERE (((tblTransactions.TransactionDate) >= " & #7/1/2004# _
'& " And (tblTransactions.TransactionDate) < " & dteDate2 _
'& "))"
strWhere = "WHERE (((tblTransactions.TransactionDate) >= " & dteDate1 _
& " And (tblTransactions.TransactionDate) < " & "#7/31/2004#" _
& "))"
. . .
A. works; B. does too but gives wrong result; C. does not. (I get a 3021, BOF or EOF, or record is deleted or there is not one)
I thought the Date variables and the string literals would be interchangable?
Building an SQL string for an ADODB recordset:
. . .
Dim dteDate1, dteDate2 As Date
cnn1.Open strSourceDB
dteDate1 = #7/1/2004#
dteDate2 = #7/31/2004#
strWhere = "WHERE (((tblTransactions.TransactionDate) >= " & #7/1/2004# _
& " And (tblTransactions.TransactionDate) < " & "#7/31/2004#" _
& "))"
'strWhere = "WHERE (((tblTransactions.TransactionDate) >= " & #7/1/2004# _
'& " And (tblTransactions.TransactionDate) < " & dteDate2 _
'& "))"
strWhere = "WHERE (((tblTransactions.TransactionDate) >= " & dteDate1 _
& " And (tblTransactions.TransactionDate) < " & "#7/31/2004#" _
& "))"
. . .
A. works; B. does too but gives wrong result; C. does not. (I get a 3021, BOF or EOF, or record is deleted or there is not one)
I thought the Date variables and the string literals would be interchangable?