Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 413
  • Last Modified:

Opening a dynaset-type recordset

I want to open a dynaset type recordset so that I can use the find methods (a table type recordset won't work for my purposes).  I have the following code run from a form:

Set cert_rst = CurrentDb.OpenRecordset("Cert_Log", dbOpenDynaset)

When I try to run the code, I get the message 'runtime error 3001: invalid argument'.  Cert_Log is a table in my database and it is spelled correctly.  I have used almost the exact same code in a different database with no problems.  That code looks like this:

Set props_rst = CurrentDb.OpenRecordset("Props", dbOpenDynaset)

The only difference between the 2 databases is that one of them is linked and has a front and back end and the other is not linked.  The one that is not linked is giving me the error message.  So I tried adding a linked table to that database and opening it as a dynaset.  I got the same error message.
In the non-linked database, it lets me open a table type recordset only if I use the default and don't specify the type.  If I add the argument 'dbOpenTable', I get the same error message.  Any ideas??????        
1 Solution

Set cert_rst = CurrentDb.OpenRecordset("[Cert_Log]", dbOpenDynaset

Log may be a reserved word in SQL

It should be in there as your error is invalid argument

wasserAuthor Commented:
I tried using brackets around the table name and I'm still getting the same error message.  
The problem must be else where in the code.

I cannot see anything wrong in the statement
Check your declarations and other preparatory code

If still a problem - post more of the code
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

wasserAuthor Commented:
I am trying to get this question deleted, as I have figured it out myself.  The problem was that the database did not have the DAO library added as a reference.  I thought it would be included automatically and didn't know I had to explicitly add it myself.  
Well done

You usually get an error on declarations if you do not do this so I guess you had just pasted a bit of code in.

My friend, your problem is
The DAO library only allow to create Dynaset or Snapshot over Linked tables or tables of external database ODBC.
You won't not create a Dynaset recordset with your not linked table

Gustavo is I am afraid - totally incorrect

I run a software house and our entire software library is DAO based.

We have tested ADO and in for the businesses we support it far too slow. We are now awaiting the next version of VB.net which wil support DAO.

DAO will support linked and unlinked tables on a direct connection or an ODBC connection..

My apologies to Gustavo but he is perfectly welcome to come here for a few lessons.
PAQ'd and 125 points refunded


Community Support Moderator
Experts Exchange

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now