I have a report that when opened by a command button code works fine, but when I try using a macro to run it the following error message appears:
Run-time error ‘3061’. Too few parameters. Expected 1.
The reason I wish to use a macro is I wanted to display a message box that said “No Records to View” if the report would not display anything. I use the same macro ‘code’ in other instances and there’s not a problem.
The macro uses the following function in a separate module. (The line Set r = db.OpenRecord … is highlighted when I debug the error message).
Function getCount(strRs As String)
Dim r As Recordset
Dim db As Database
Set db = CurrentDb
Set r = db.OpenRecordset(strRs)
getCount = r.RecordCount
r.Close
End Function
I can supply more info about the macro if necessary – it was just difficult to know how to lay it all out! Hope this all makes sense!
Run-time error ‘3061’. Too few parameters. Expected 1.
The reason I wish to use a macro is I wanted to display a message box that said “No Records to View” if the report would not display anything. I use the same macro ‘code’ in other instances and there’s not a problem.
The macro uses the following function in a separate module. (The line Set r = db.OpenRecord … is highlighted when I debug the error message).
Function getCount(strRs As String)
Dim r As Recordset
Dim db As Database
Set db = CurrentDb
Set r = db.OpenRecordset(strRs)
getCount = r.RecordCount
r.Close
End Function
I can supply more info about the macro if necessary – it was just difficult to know how to lay it all out! Hope this all makes sense!