S
Simon Cleal
Access 2000
Im trying to open a parameter query form VB code I've pinched the code from
http://www.mvps.org/access/queries/qry0003.htm and modified it as follows:
Dim db As Database 'current database
Dim rs As Recordset 'holds query resultset
Dim qdfParmQry As QueryDef 'the actual query object
Set db = CurrentDb()
Set qdfParmQry = db.QueryDefs("qryStatusatdate1")
qdfParmQry("StartDate") = #1/1/2000#
Set rs = qdfParmQry.OpenRecordset()
The query I'm trying to open is as follows:
SELECT tblStatus.lngKey, tblStatus.dteChangeDate
FROM tblStatus
WHERE tblStatus.dteChangeDate<[StartDate]
The problem is I get a type mismatch error on the last line of code.
I've tried a few different things in order to solve the problem including
changing the # to " and putting a CDate() function either in the code or in
the query or setting up a date variable to hold the criteria
A couple more points... When I get this query working the date is going to
be hooked up to a text box... The query is a source table for a much larger
query but this is the only part of it that has selection criteria
Im trying to open a parameter query form VB code I've pinched the code from
http://www.mvps.org/access/queries/qry0003.htm and modified it as follows:
Dim db As Database 'current database
Dim rs As Recordset 'holds query resultset
Dim qdfParmQry As QueryDef 'the actual query object
Set db = CurrentDb()
Set qdfParmQry = db.QueryDefs("qryStatusatdate1")
qdfParmQry("StartDate") = #1/1/2000#
Set rs = qdfParmQry.OpenRecordset()
The query I'm trying to open is as follows:
SELECT tblStatus.lngKey, tblStatus.dteChangeDate
FROM tblStatus
WHERE tblStatus.dteChangeDate<[StartDate]
The problem is I get a type mismatch error on the last line of code.
I've tried a few different things in order to solve the problem including
changing the # to " and putting a CDate() function either in the code or in
the query or setting up a date variable to hold the criteria
A couple more points... When I get this query working the date is going to
be hooked up to a text box... The query is a source table for a much larger
query but this is the only part of it that has selection criteria