LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Data From Excel Range To Existing Access Table

Hi

your code works great and I have modified a little bit so make it once
insert it to Access, it will then be deleted and looks like it is "moved" to
Access. However,

I have 2 problems he
1. the first field i have in the DB is an autonumber field, how can I handle
it ? if I put an empty value, it will prompt error

2. the process seems a little slow, it seems using loop from row to row
quite slow.

thanks a lot

Leung


"michelxld" wrote:


Hello

I hope this help you

Sub exportDatas_Excel_Access()
'Activate Microsoft ActiveX Data Objects x.x Library
Dim Conn As New ADODB.Connection
Dim rsT As New ADODB.Recordset
Dim Cell As Range
Dim i As Integer

With Conn
.Provider = "Microsoft.JET.OLEDB.4.0"
.Open "C:\dataBase.mdb"
End With

With rsT
.ActiveConnection = Conn
.Open "Table1", LockType:=adLockOptimistic
End With

'export range("C1:C4") in Access table
With rsT
.AddNew
For i = 0 To 3
.Fields(i).Value = Cells(i + 1, 3)
Next i
.Update
End With

rsT.Close
Conn.Close
End Sub


Regards ,
michel


--
michelxld
------------------------------------------------------------------------
michelxld's Profile: http://www.excelforum.com/member.php...o&userid=17367
View this thread: http://www.excelforum.com/showthread...hreadid=392393


 
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
Increasing the Source Data range for an existing Pivot Table Shams Excel Worksheet Functions 2 October 10th 06 05:22 PM
How to convert existing Excel List into a table in Access? anna New Users to Excel 2 June 18th 06 11:57 PM
Transfer to an existing Access Table Secret Squirrel Excel Discussion (Misc queries) 0 March 17th 06 11:31 PM
vb code to export data into existing Access table desperate Excel Programming 2 November 19th 03 05:05 PM
Excel Range to Access Table Tokash Excel Programming 1 August 19th 03 08:58 AM


All times are GMT +1. The time now is 04:52 PM.

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

About Us

"It's about Microsoft Excel"