Hi,
I've got below piece of code;
Dim cr,rd
Dim strSQL As String
Dim rsa As New ADODB.Recordset
Dim cnn As Connection
Set cnn = CurrentProject.Connection
cr = txtCur
rd = txtRateDate
strSQL = "select " & cr & " from tblRates where ExchDate=" & "#" & rd & "#"
rsa.Open strSQL, cnn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
As seen, rd contains a date. When I try to open a recordset with this SQL string, this date value is not selected. I don't receive any error, but the recordset is not filtered depending on the variable rd's value so, rsa.RecordCount=0. Where am I wrong? How can I pass a date variable in where criteria?
Thanks a lot
Murat
I've got below piece of code;
Dim cr,rd
Dim strSQL As String
Dim rsa As New ADODB.Recordset
Dim cnn As Connection
Set cnn = CurrentProject.Connection
cr = txtCur
rd = txtRateDate
strSQL = "select " & cr & " from tblRates where ExchDate=" & "#" & rd & "#"
rsa.Open strSQL, cnn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
As seen, rd contains a date. When I try to open a recordset with this SQL string, this date value is not selected. I don't receive any error, but the recordset is not filtered depending on the variable rd's value so, rsa.RecordCount=0. Where am I wrong? How can I pass a date variable in where criteria?
Thanks a lot
Murat