U
user
Hi,
I have a form with query criteria, then a button to open another form to
display the query results. I want to capture when no records are found so
as not to open an empty result form. I tried a bunch of stuff like:
================
Dim d As DAO.Database
Dim q As DAO.QueryDef
Dim r As DAO.Recordset
Set d = CurrentDb
Set q = d.QueryDefs("qryLastInitialReport")
Set r = q.OpenRecordset() ' error below in this line
If r.RecordCount > 0 Then
' open the report
Else
MsgBox "No records found", vbOKOnly
End If
=============
but when I run this I get:
Run-time error '3061'
Too few parameters. Expected 1.
TIA, Doug
I have a form with query criteria, then a button to open another form to
display the query results. I want to capture when no records are found so
as not to open an empty result form. I tried a bunch of stuff like:
================
Dim d As DAO.Database
Dim q As DAO.QueryDef
Dim r As DAO.Recordset
Set d = CurrentDb
Set q = d.QueryDefs("qryLastInitialReport")
Set r = q.OpenRecordset() ' error below in this line
If r.RecordCount > 0 Then
' open the report
Else
MsgBox "No records found", vbOKOnly
End If
=============
but when I run this I get:
Run-time error '3061'
Too few parameters. Expected 1.
TIA, Doug