Link to home
Start Free TrialLog in
Avatar of wasser
wasserFlag for United States of America

asked on

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??????        
Avatar of WRNewman
WRNewman

Try

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

Avatar of wasser

ASKER

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
Avatar of wasser

ASKER

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

Greetings
Gustavo
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.
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial