G
Guest
I keep getting a "Too few parameters error" for the "Set rst line =" when
using the following code:
Option Compare Database
Public Function Cost(strType As String, CostingID As Long) As Currency
Dim rst As DAO.Recordset
If strType = "CURRENT" Then
Set rst = CurrentDb.OpenRecordset("Select [Total Current Cost] from
qryTotalCurrentCosts")
Cost = rst.Fields("Total Current Cost")
rst.Close
End If
End Function
Any ideas how I can fix this? I am referencing the Microsoft DAO 3.6
library. I've also tried the datatype QueryDef in place of recordset but then
the "Cost = rst.fields" line gives me the error "Items not found in this
collection".
using the following code:
Option Compare Database
Public Function Cost(strType As String, CostingID As Long) As Currency
Dim rst As DAO.Recordset
If strType = "CURRENT" Then
Set rst = CurrentDb.OpenRecordset("Select [Total Current Cost] from
qryTotalCurrentCosts")
Cost = rst.Fields("Total Current Cost")
rst.Close
End If
End Function
Any ideas how I can fix this? I am referencing the Microsoft DAO 3.6
library. I've also tried the datatype QueryDef in place of recordset but then
the "Cost = rst.fields" line gives me the error "Items not found in this
collection".