Hello,
I'm kind of new to VBA and Access, so please forgive me if I'm doing stuff all wrong:
I have the following code wich gives me a Error 13 Type Mismatch:
[CODE=vb]
Dim db As Database, rs As Recordset
Dim strSQL As String
Dim ToDate, TillDate As String
ToDate = "" & GP_DateFrom.Val ue & ""
TillDate = "" & GP_DateUntil.Va lue & ""
strSQL = "SELECT * FROM SBB_General_Pur pose WHERE Datum BETWEEN " _
& ToDate & " AND " & TillDate & ";"
Set db = CurrentDb()
Set rs = db.OpenRecordse t(strSQL)
' if it gets here then the code to open the recordset has worked
lstDisplay.Requ ery
rs.Close
db.Close
[/CODE]
It gives the error on the Set rs=db.OpenRecor dset(strSQL) line.
Anyone any ideas on how to resolve this?
Thanks in advance,
Jasper
I'm kind of new to VBA and Access, so please forgive me if I'm doing stuff all wrong:
I have the following code wich gives me a Error 13 Type Mismatch:
[CODE=vb]
Dim db As Database, rs As Recordset
Dim strSQL As String
Dim ToDate, TillDate As String
ToDate = "" & GP_DateFrom.Val ue & ""
TillDate = "" & GP_DateUntil.Va lue & ""
strSQL = "SELECT * FROM SBB_General_Pur pose WHERE Datum BETWEEN " _
& ToDate & " AND " & TillDate & ";"
Set db = CurrentDb()
Set rs = db.OpenRecordse t(strSQL)
' if it gets here then the code to open the recordset has worked
lstDisplay.Requ ery
rs.Close
db.Close
[/CODE]
It gives the error on the Set rs=db.OpenRecor dset(strSQL) line.
Anyone any ideas on how to resolve this?
Thanks in advance,
Jasper
Comment