M
Matt.
Hi all!
Can somebody please tell me why I'm getting a "type Mismatch" error on the
"Set rs" line?
I'm using Access 2000, and would prefer and ADO solution, but I'm unsure of
the connection string for ADO into a Curentdb(). Anyway, I thought this
would work simply enough. I was wrong. Any help much appreciated.
cheers,
Matt.
---------------------------------------------------
Function GetStartDate(intYear As Integer, intMonth As Integer) As Date
Dim db As Database
Dim rs As Recordset
Dim strSQL As String
Dim intRecords As Integer
strSQL = "Select datStart From tblFiscal " _
& "Where intYear = " & Year(Date) & " AND intFiscalMonth = " &
intMonth
MsgBox "strSQL: " & strSQL
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
'db.Execute strSQL, dbFailOnError
GetStartDate = CDate(rs("datStart"))
End Function
Can somebody please tell me why I'm getting a "type Mismatch" error on the
"Set rs" line?
I'm using Access 2000, and would prefer and ADO solution, but I'm unsure of
the connection string for ADO into a Curentdb(). Anyway, I thought this
would work simply enough. I was wrong. Any help much appreciated.
cheers,
Matt.
---------------------------------------------------
Function GetStartDate(intYear As Integer, intMonth As Integer) As Date
Dim db As Database
Dim rs As Recordset
Dim strSQL As String
Dim intRecords As Integer
strSQL = "Select datStart From tblFiscal " _
& "Where intYear = " & Year(Date) & " AND intFiscalMonth = " &
intMonth
MsgBox "strSQL: " & strSQL
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
'db.Execute strSQL, dbFailOnError
GetStartDate = CDate(rs("datStart"))
End Function