Public Function getRowsVar(tbl As String, searchValue As String) As Integer
Dim db As Database
Set db = CurrentDb()
Dim rs As DAO.Recordset
Set rs = db.OpenRecordset("SELECT * FROM " + tbl + " WHERE TYPE = '" + searchValue + "';")
r = rs.RecordCount
MsgBox r
MsgBox rs.RecordCount
Set rs = Nothing
Set db = Nothing
getRowsVar = r
End Function
|