Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel to Access Question

I have a question about exporting data from excel to access using ado.
i am kind of n00b still, teaching myself vba and vb, but i know
C/C++/opengl/direct3d/java/html/perl/cgi/sql, etc. so i am not a
programming n00b :D well, now for the question. i got sick of
searching the help files and net trying to find a way to change a
record using vba and ado. i use ado to open the database to add
fields, so i am assuming there is a command to search out a key and
edit and/or replace/delete/change the record. can someone inform me on
a good way to do this? i only need to change one record at a time.

thanks!!
Nonlinear



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Excel to Access Question


The way to do this is use an ADO Command object to send an INSERT,
UPDATE, or DELETE SQL statement to the database. Here's a quick example
based on one of my databases. Note that this code requires you to set a
reference to the Microsoft ActiveX Data Objects 2.X Object Library under
Tools/References in the VBE.

Sub UpdateAccessRecord()
Dim cnn As ADODB.Connection
Dim szConnection As String
Dim szSQL As String
szConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=E:\MyDatabase.mdb;"
szSQL = "UPDATE Styles SET JobID = 999 WHERE StyleID = 37;"
Set cnn = New ADODB.Connection
cnn.Open szConnection
cnn.Execute szSQL
cnn.Close
Set cnn = Nothing
End Sub

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Nonlinear" wrote in message
...
I have a question about exporting data from excel to access using ado.
i am kind of n00b still, teaching myself vba and vb, but i know
C/C++/opengl/direct3d/java/html/perl/cgi/sql, etc. so i am not a
programming n00b :D well, now for the question. i got sick of
searching the help files and net trying to find a way to change a
record using vba and ado. i use ado to open the database to add
fields, so i am assuming there is a command to search out a key and
edit and/or replace/delete/change the record. can someone inform me on
a good way to do this? i only need to change one record at a time.

thanks!!
Nonlinear



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access to Excel Question Bunky Excel Discussion (Misc queries) 2 March 1st 09 05:14 PM
Excel Pivot Table or Access Cross Tab Query Question greene2j Excel Discussion (Misc queries) 0 January 14th 08 01:49 AM
Question about limiting access to functions in Excel Brian Smith Excel Discussion (Misc queries) 1 February 1st 07 12:48 PM
Macro Question - Excel to Access and back again Mike The Newb Excel Discussion (Misc queries) 1 October 19th 06 02:35 PM
Access Form In An Access Report (SubForm) Question Gary Links and Linking in Excel 0 January 27th 06 05:54 AM


All times are GMT +1. The time now is 09:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"