J
Jackson via AccessMonster.com
Hi,
I've struggled with this a few times to understand what the problem is and
all posts I've seen never seemed to have a concrete answer, this seems to be
some voodoo area of access. I'm simply trying to open a recordset which is a
query (no criteria on it) so I can process records and create a file, start
of code for the Public Sub is:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim intFileNum As Integer
Dim strExportFile As String
Dim varHeader As Variant
Dim strDelimiter As String
Dim varTrades As Variant
Dim dteRecDate As Date
dteRecDate = Format([Forms]![frmHome]![dteRecDate], "dd-mmm-yyyy")
Set db = CurrentDb()
Set rs = db.OpenRecordset("SELECT * FROM qryLIVEFXTradesTDP WHERE [trade_ldt]
=dteRecDate")
The last line is where it fails, I get 'Run-time error '3061' Too few
parameters. Expected 1.'
I've declared the date and written the criteria in VBA so I can't work out
why access doesn't understand my criteria? If I run it as:
Set rs = db.OpenRecordset("qryLIVEFXTradesTDP")
It will open the recordset fine, obviously with more data than I'm after...
please help if you know what I'm doing wrong or have any ideas?
I've struggled with this a few times to understand what the problem is and
all posts I've seen never seemed to have a concrete answer, this seems to be
some voodoo area of access. I'm simply trying to open a recordset which is a
query (no criteria on it) so I can process records and create a file, start
of code for the Public Sub is:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim intFileNum As Integer
Dim strExportFile As String
Dim varHeader As Variant
Dim strDelimiter As String
Dim varTrades As Variant
Dim dteRecDate As Date
dteRecDate = Format([Forms]![frmHome]![dteRecDate], "dd-mmm-yyyy")
Set db = CurrentDb()
Set rs = db.OpenRecordset("SELECT * FROM qryLIVEFXTradesTDP WHERE [trade_ldt]
=dteRecDate")
The last line is where it fails, I get 'Run-time error '3061' Too few
parameters. Expected 1.'
I've declared the date and written the criteria in VBA so I can't work out
why access doesn't understand my criteria? If I run it as:
Set rs = db.OpenRecordset("qryLIVEFXTradesTDP")
It will open the recordset fine, obviously with more data than I'm after...
please help if you know what I'm doing wrong or have any ideas?