Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset objects HELP!

Status
Not open for further replies.

hysteria

Programmer
Sep 26, 2002
13
CA
What I am trying to do is accessing the database from excel and adding a record to a certain table.I am able to use it using ADODB recordsets, but I want to use simply DAO because some VBA libraries are missing on some other test stations so ADO libraries cannot be referenced.That gives a problem in consistency.
I was running into this problem..
Dim db As Database, rs As Recordset, r As Long

Set db = OpenDatabase("C:\databaseName") ' open the database
Set rs = db.OpenRecordset("tblName",dbOpenTable) ' get all records in a table

I get a run time error ("Invalid Operation") when the recordset has to be set.It says that "You tried to write to a read-only property" in the help menu.I cannot figure out why the recordset is not set to that table.Please help me out here.Thanx.
 
Is the Table linked. If it is then you can't use dbOpenTable. You have to use dbOpenDynaset.

Paul
 
yes it is linked..
I tried dbOpenDynaset
Now its giving me an error "Type mismatch"
How can it be a type mismatch!!!...
Set rs=db.OpenRecordset("tableName",dbOpenDynaset)

i dont see why this line has a type mismatch!
 
There might be a data type mismatch between the recordset you defined in your Access database and your excel spreadsheet.
 
hysteria, sorry I lost this post, I'm just figuring out how to follow 5 different forums. The answer to your problem, if you still need it is
Dim db as DAO.Database
Dim rs as DAO.Recordset

You need to identify which library you want access to use for you code.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top