Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: How to add new records to a table using VBA?


Message #1 by "Darron Michael" <darron.michael@h...> on Thu, 15 Nov 2001 23:06:54
I am using MS Access 97 as a front-end for an SQL2000 database.



I have established how to SELECT data from the SQL2000 tables using VBA.



I can also UPDATE data in those tables.



For some reason, I can't seem to add new records.



If anyone has a function that will establish the right connection that 

works for method .addnew, please help me out.



Darron.Michael@h...
Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Thu, 15 Nov 2001 15:28:21 -0800
.AddNew implies you're doing this via a recordset--be careful about setting

the recordset's .CursorType property.  I would guess that adOpenDynamic &

adOpenKeySet should support adds, tho that varies from provider to provider

(and depending on .CursorLocation as well).  Play around with different

settings & recall that you don't always get what you ask for with ADO.  Call

the .Supports(adAddNew) method of your recordset to see whether ADO thinks

your recordset supports adds.



HTH,



-Roy



Roy Pardee

Programmer/Analyst

SWFPAC Lockheed Martin IT

Extension 8487



-----Original Message-----

From: Darron Michael [mailto:darron.michael@h...]

Sent: Thursday, November 15, 2001 3:07 PM

To: Access

Subject: [access] How to add new records to a table using VBA?





I am using MS Access 97 as a front-end for an SQL2000 database.



I have established how to SELECT data from the SQL2000 tables using VBA.



I can also UPDATE data in those tables.



For some reason, I can't seem to add new records.



If anyone has a function that will establish the right connection that 

works for method .addnew, please help me out.



Darron.Michael@h...





  Return to Index