Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default export data from Excel to MS Access (ADO) using VBA

I'm looking for an example VBA Code to transfer data from Excel to MS Access
2000. The issue is that the spreadsheet contains more then 100 hundred named
cells which needs to be transferred to the corresponding Field Name in MS
Access 2000. I'm not a beginner programmer but i don't want to code all the
separate named cells into MS Access so i'm looking for some smart code to do
this.

Does anyone know wehere i can find some example VBA code to accomplish this.

Thank you in advance

Peter Brom




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default export data from Excel to MS Access (ADO) using VBA

Not just 100% sure exactly what you are looking for but here is a fairly
generic procedure to write to an Access Database.

Private Const m_cDBLocation As String = "C:\Stuff.mdb"
Private Const m_cLogFile As String = "tblLogFile"

Public Sub LogIn()
Dim cnt As New ADODB.Connection
Dim rst As New ADODB.Recordset

On Error GoTo ErrorHandler
'Open connection to the database
cnt.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & m_cDBLocation & ";"

rst.Open m_cLogFile, cnt, adOpenKeyset, adLockOptimistic,
adCmdTableDirect
rst.AddNew

rst.Fields("User Name") = "Bob"
rst.Fields("Logged") = "In"
rst.Fields("Time") = Now()

rst.Update
' Close ADO objects
rst.Close
cnt.Close
Set rst = Nothing
Set cnt = Nothing
End If
Exit Sub

ErrorHandler:
'Add error handling
End Sub

HTH

"Peter Brom" wrote:

I'm looking for an example VBA Code to transfer data from Excel to MS Access
2000. The issue is that the spreadsheet contains more then 100 hundred named
cells which needs to be transferred to the corresponding Field Name in MS
Access 2000. I'm not a beginner programmer but i don't want to code all the
separate named cells into MS Access so i'm looking for some smart code to do
this.

Does anyone know wehere i can find some example VBA code to accomplish this.

Thank you in advance

Peter Brom





  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default export data from Excel to MS Access (ADO) using VBA

Have you tried using the Import Spreadsheet Wizard in Access? Depending on
how your data is structured in Excel, you may be able to import it without
programming at all.

"Peter Brom" wrote:

I'm looking for an example VBA Code to transfer data from Excel to MS Access
2000. The issue is that the spreadsheet contains more then 100 hundred named
cells which needs to be transferred to the corresponding Field Name in MS
Access 2000. I'm not a beginner programmer but i don't want to code all the
separate named cells into MS Access so i'm looking for some smart code to do
this.

Does anyone know wehere i can find some example VBA code to accomplish this.

Thank you in advance

Peter Brom





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
Data Export from Access to Excel Teresa NS Excel Discussion (Misc queries) 2 December 2nd 08 06:46 PM
How can I Export data from to Access to an Excel Template Chuck Excel Discussion (Misc queries) 0 July 6th 06 08:20 PM
Export memo field in Access to Excel - data gets cut off cpurpleturtle Excel Discussion (Misc queries) 0 June 22nd 06 04:24 PM
Export Excel Data to Access With a Macro!!! Jac Excel Discussion (Misc queries) 3 December 28th 04 07:39 PM
Export Excel data to Access Security problem Annelie[_3_] Excel Programming 5 December 30th 03 11:14 PM


All times are GMT +1. The time now is 09:39 PM.

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"