Home |
Search |
Today's Posts |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Increasing the Source Data range for an existing Pivot Table | Excel Worksheet Functions | |||
How to convert existing Excel List into a table in Access? | New Users to Excel | |||
Transfer to an existing Access Table | Excel Discussion (Misc queries) | |||
vb code to export data into existing Access table | Excel Programming | |||
Excel Range to Access Table | Excel Programming |