Group:  Microsoft Access ยป microsoft.public.access.modulesdaovba.ado
Thread: Using OpenRecordset

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Using OpenRecordset
franky 24.02.2006 18:20:06
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.
RE: Using OpenRecordset
franky 24.02.2006 18:37:29
Stupid me... It's working. The error was happening further in the code.
SORRY.

"franky" wrote:

[Quoted Text]
> 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.

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net