473,791 Members | 3,193 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Recordset Addnew for an mdb

2 New Member
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.connectio n 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 4132
Murtaza
2 New Member
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
1967
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 to update the new recordset which I can do...I think however that I have missed something, as later in my code it only seems to iterate once, and there should be at least 2 rows in the recordset... Can anyone confirm that when I use something...
0
1532
by: belacyrf | last post by:
Here's the code: ------------------------------------------------------------------- accessID = request("accessID") strSQL = "SELECT * From PendingAccRequests Where AccessID = "&accessID 'Create the Recordset object and run SQL statement Set accRS = Server.CreateObject ("ADODB.Recordset") accRS.Open strSQL, objConn
11
11562
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 continuous (and datasheet) form. I needed it for a data entry subform and I haven't been able to get it to work. Is there any rational for why it doesn't work with a subForm? Any suggestions for a datasheet data entry subform with two...
2
15582
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 record after recordset.update is executed? Recordset!CustomerID doesn't work because the recordset bookmark is on the first record. Moving to the last record doesn't work if the recordset is based on a query and the recordset is sorted. Thanks! ...
13
3487
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 query: QryICTMassDistribution3) , I then use a form and the code below to create a new record in the corrispondence table to show what corrispondence has been sent to various companies.
5
6444
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 solution: 1. I am not allowed to use ODBC 2. I have to use ADO 3. I am not allowed to use Linked tables
5
25462
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 Adodc1.Recordset.Update Adodc1.Recordset.MoveFirst Adodc1.Recordset.MoveNext Adodc1.Recordset.Delete
4
11563
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, but I don't want to have to read/write everything from/to disk every time I need to use the data. I tried: Dim r As DAO.Recordset, tdf As DAO.TableDef
0
9012
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 Recordset? Does the Recordset support Bookmarks? Can we use the Find and/or Seek Methods with this Recordset? Does the Recordset support the use of Indexes? Will the Absoluteposition property be able to be used on this Recordset? etc....
2
2115
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 to a table. Code: Q2 = "SELECT T_SMP_RCNR.KEY_ORDER, T_SMP_RCNR.RCNR, T_SMP_RCNR.KEY_RCNR " & _ "FROM T_SMP_RCNR LEFT JOIN Q_MaxOfSMPRCNR ON
0
9669
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10427
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5431
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.