Using OpenRecordset

F

franky

Hello.

How do I open a recorset object by passing in the name of the query. For
example:

Public Sub Testing(QueryName As String)

Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset(QueryName)
....

This will produce the following error; "Object variable or With block
variable not set". I've also tried;CurrentDb.OpenRecordset("""" & QueryName
& """"). I need to be able to pass the query name and NOTthe sql statement.
Any suggestions?

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top