Unanswered: Using Access-query as source for a recordset
When starting my DB I want to make a check if a certain field is filled in.
Therefor I made a query (using the Access Query-wizard) which I use for generating a report.
Now even if there are no records in the query a (empty) report is shown.
So I was thinking of using a recordset (based on my query) and if the recordcount is null the report will not be shown.
But is it possible to create a recordset based on an access-query ?
If yes how can I do that ?
Originally posted by Risky
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Set dbs = CurrentDb
Set rst = dbs.QueryDefs("qryCheck").OpenRecordset
If rst.EOF then
'We have no records
I did following, but it gives me an error.
Private Sub Form_Load()
Dim rs As New ADODB.Recordset
rs.Open CurrentDb.QueryDefs("myQuery"), CurrentProject.Connection, adOpenStatic, adLockReadOnly
If rs.RecordCount > 0 Then
'Here comes the rest of my code
Errormessage is :
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another