L
Leslie Coover
Why do I get a Type mismatch error concerning the line
Set rec = db.OpenRecordset(strSQL)
when I try to run the following function?
Function GT()
Dim db As Database 'current database
Dim rec As Recordset 'recordset of Scenario
Dim strSQL As String 'SQL select statement
strSQL = "SELECT Sum(tblDiv.Div) AS SumOfDiv FROM tblDiv;"
Set db = CurrentDb()
Set rec = db.OpenRecordset(strSQL)
GT = rec("SumOfDiv")
rec.Close
Set rec = Nothing
End Function
Thanks!!
Set rec = db.OpenRecordset(strSQL)
when I try to run the following function?
Function GT()
Dim db As Database 'current database
Dim rec As Recordset 'recordset of Scenario
Dim strSQL As String 'SQL select statement
strSQL = "SELECT Sum(tblDiv.Div) AS SumOfDiv FROM tblDiv;"
Set db = CurrentDb()
Set rec = db.OpenRecordset(strSQL)
GT = rec("SumOfDiv")
rec.Close
Set rec = Nothing
End Function
Thanks!!