473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Recordset Addnew for an mdb

Hi all

Looking for assistance on an issue in Excel (2000 sp2 / pro) and access 2003.

I have a database and in my VB code have created a ADODB.connection to it. It is called conn. I have used it for sqlPassThrough queries as follows:

Expand|Select|Wrap|Line Numbers
  1. modfindSQL = "SELECT ....."
  2.  
  3. Set modfindrs = conn.Execute(modfindSQL, , dbSQLPassThrough)
This works fine. Problem arises when I try to use addnew. I recognise I won't be able to use the above and have tried the following:

Expand|Select|Wrap|Line Numbers
  1. Set rstProjects = conn.openRecordset("Projects", dbOpenDynaset, dbAppendOnly, dbopentable)
  2.  
  3.     With rstProjects
  4.         .AddNew
  5.         ![Project ID] = ProjectID
  6.         .
  7.         .
  8.         .
  9.       .Update
  10.     End With
I have the following references:

VB for all Applications
MS Excel 9.0 Object Library
OLE Automation
MS Forms 2.0 Object Library
MS Office 9.0 Object Library
MS ActiveX Data Objects 2.5 Library

I have tried enabling the following too:

MS ActiveX Data Objects Recordset 2.6 Library
MS ADO Ext 2.6 for DLL and Security

With no avail. The error I get is:

Runtime Error '3001':
Application-defined or object-defined Error

and i have also tried :

Expand|Select|Wrap|Line Numbers
  1. Set rstProjects = conn.Execute("Projects", , dbSQLPassThrough)
  2. Set rstProjects = conn.Execute("Projects", , dbConsistent)
  3. etc
  4.  

Any help will be much appreciated..

Many thanks
Sep 16 '06 #1
1 4115
Solved:

Did not ahve DAO objects. Need refferences to them, then use a DAO.Conn or use a DAO.database object and then you can use openRecordset...

Thanks
Sep 17 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Rob Meade | last post by:
evenin' k - I've got a recordset that I'm dumping another recordset into - because the source comes from a database that I cant update (probably makes more sense to me that bit) - anyway, I need...
0
by: belacyrf | last post by:
Here's the code: ------------------------------------------------------------------- accessID = request("accessID") strSQL = "SELECT * From PendingAccRequests Where AccessID = "&accessID ...
11
by: Ian Ornstein | last post by:
in posting http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&newwindow=1&selm=bmEK9.43452%24lj.1060600%40read1.cgocable.net Lyle showed us that an ADODB.Recordset can be created and attached to a...
2
by: Harold | last post by:
Sat I have a customers table with the fields CustomerID and Customer and I use the recordset.addnew method to add a new record to the table. What is the best way to get the CustomerID of the new...
13
by: Jan | last post by:
Hi I have a database that I use to keep track of the sales promotions that we send to companies. I normally send a mailing based on a subset of the companies in the database (found using the...
5
by: Fabrice | last post by:
Hello everybody, I'm working with Access 2002. I have to import Data from a Foxpro table that contains 25000 records in an Access table. I have a couple of restrictions placed on me for the...
5
by: tony010409020622 | last post by:
I just spent 4 months taking a dotnet class where i learned very little. One of the things I did not learn is this: What are the dotnet equivilents of commands such as: Adodc1.Recordset.AddNew...
4
by: darkforcesjedi | last post by:
Creating a connectionless recordset in ADO is simple enough, but how do you do it in DAO? I want a recordset stored in memory so I can filter/sort it easily. If I create a table I can make it work,...
0
ADezii
by: ADezii | last post by:
When you create an ADO Recordset, you should have some idea as to what functionality the Recordset does/does not provide. Some critical questions may, and should, be: Can I add New Records to the...
2
by: Kamil | last post by:
Hi. Is it possible to add new record to my recordset which is based on a query? I want to use this recordset only for temp starage of data, and I don't want to update values from this recordset...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.