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

Hello,
I'm new to office soln dev so bear with me. How do I
take data on an Excel sheet and update an access table
with it? I have an empty access table and I need to get
info from Excel into it. How do I go about this? Some
bulk operation would be the best because I can imagine
that going line by line would take too long. Thanks a lot
in advance for your help!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default updating Access table with Excel data

You can start here - this should give you some ideas:

http://www.erlandsendata.no/english/vba/adodao/

Regards,
Tom Ogilvy

"newbie" wrote in message
...
Hello,
I'm new to office soln dev so bear with me. How do I
take data on an Excel sheet and update an access table
with it? I have an empty access table and I need to get
info from Excel into it. How do I go about this? Some
bulk operation would be the best because I can imagine
that going line by line would take too long. Thanks a lot
in advance for your help!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default updating Access table with Excel data

Hi there try this:
Sub CopyDatatoAccess
Dim Range1 As Range
Dim Array1 As Variant
Dim x As Variant
Dim Db1 As Dao.Database
Dim Rs1 As Dao.Recordset


'First, open the database. Chane the Path Name and the Database Name for
yours
Set Db1 = DBEngine.OpenDatabase(ThisWorkbook.Path & "\sampdata.mdb")

'Then, open the recordset. Again Change the name of the table for yours
Set Rs1 = Db1.OpenRecordset("distributors", dbOpenDynaset)

'Then, determine the size of the worksheet range.
Set Range1 = Worksheets("Sheet1").Range("A1").CurrentRegion.Off set(1, 0)
Set Range1 = Range1.Resize(Range1.Rows.Count - 1, Range1.Columns.Count)
Range1.Select

'Read the worksheet range into an array.
Array1 = Range1.Value

'Then write the data from the array to the recordset.
'Note that for each new record, you must first call Addnew
'then set the value property of the fields, and then call Update.
For x = 1 To UBound(Array1, 1)
With Rs1
.AddNew
.Fields("Field1") = Array1(x, 1)
.Fields("Field2") = Array1(x, 2)
.Fields("Field3") = Array1(x, 3)
.Fields("Field4") = Array1(x, 4)
.Fields("Field5") = Array1(x, 5)
.Fields("Field6") = Array1(x, 6)
.Fields("Field7") = Array1(x, 7)
.Fields("Field8") = Array1(x, 8)
.Fields("Field9") = Array1(x, 9)
.Update
End With
Next
'Keep adding the fields depending on how many Colunms you may have in
excel
'Close the database.
Db1.Close

End Sub


"Tom Ogilvy" wrote in message
...
You can start here - this should give you some ideas:

http://www.erlandsendata.no/english/vba/adodao/

Regards,
Tom Ogilvy

"newbie" wrote in message
...
Hello,
I'm new to office soln dev so bear with me. How do I
take data on an Excel sheet and update an access table
with it? I have an empty access table and I need to get
info from Excel into it. How do I go about this? Some
bulk operation would be the best because I can imagine
that going line by line would take too long. Thanks a lot
in advance for your help!






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
updating data from Access Ruth Excel Discussion (Misc queries) 2 September 4th 09 07:53 PM
Updating data with an ODBC link to ACCESS Excel Worksheet Functions 1 July 6th 06 02:09 PM
Data table is not updating correctly in excel 2003 Nathaniel Givens Excel Discussion (Misc queries) 3 June 1st 06 02:55 AM
Data from Excel to Access Table Secret Squirrel Excel Discussion (Misc queries) 11 December 2nd 05 11:58 PM
New Excel data does not appear in linked Access table JohnL Excel Discussion (Misc queries) 0 October 7th 05 04:31 PM


All times are GMT +1. The time now is 08: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"