Recordsets, Manipulating a Table from a Module

  • Thread starter Thread starter Kurt Radecki
  • Start date Start date
K

Kurt Radecki

Hello-

I'm having the hardest time doing what I think should be *so* easy.

My goal: Open a recordset (or something else) that allows me to open the
data in a table, add to it, values, etc.

I see examples posted on this site that show the following code:

dim dbs as database

I am using MS Access 2002. It does not recognize database as a datatype.

So, instead of using this:

dim dbs as database

dbs = currentdb

I just used currentdb as such and tried this:
dim rsInfo as recordset
set rsInfo = currentdb.openrecordset("CSPI",dbOpenTable)

When this failed (error: "Run-time error '3001': Invalid Argument"), I
tried using the following:
set rsInfo = currentdb.openrecordset("Select CSPI.ID from
CSPI",dbOpenDynaset)

I get the same error, "Run-time error '3001': Invalid Argument".

What am I missing?

Thanks in advance. Any help is much appreciated.
-Kurt
 
I just used currentdb as such and tried this:
dim rsInfo as recordset
set rsInfo = currentdb.openrecordset("CSPI",dbOpenTable)

you are trying to use DAO, but there is no reference in 2002 (only ADO
as default)

1. go to references and set a reference to Microsoft DAO 3.6

and then
dim rsInfo as DAO.recordset
 
Thanks Andi. I have experience using DAO, not ADO. I am not a
professional programmer (anymore) and I don't have plans to be one
anytime soon. That said, if there are advantages to using ADO, I'm open
to learning it. Do you recommend ADO?

-Kurt
 
If all you're going to be doing is going against a Jet database (i.e. an MDB
file), there's no reason to switch to ADO. DAO was designed specifically for
Jet, so it's almost always faster.

If there's a change you might upsize your database to, say, SQL Server or
Oracle at some time in the future, a case could be made for using ADO.
However, there are usually enough other changes that'll have to be made if
you're making such a switch that you it probably won't make that much
difference in the overall conversion effort.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Kurt Radecki said:
Thanks Andi. I have experience using DAO, not ADO. I am not a
professional programmer (anymore) and I don't have plans to be one
anytime soon. That said, if there are advantages to using ADO, I'm open
to learning it. Do you recommend ADO?

-Kurt
 
Thanks Andi. I have experience using DAO, not ADO. I am not a
professional programmer (anymore) and I don't have plans to be one
anytime soon. That said, if there are advantages to using ADO, I'm open
to learning it. Do you recommend ADO?

Please don't start such discussion, I recommend nothing, I use the
technology which helps me to accomplish what I need.

My preference is DAO, because I started with it, sometimes I have to
use ADO, because DAO doesn't work.

in other words: I am to lazy (maybe to old?) to change and I have a
lot of function which are written for DAO.
 
Hi,
Please help. Could you please tell me where should I set the DAO 3.6
reference. I am trying to open a table and getting "invalid argument" error.

Thanks
 
Back
Top