Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to access ACCESS from Excel!

Hi

I'm trying to run a macro from Excel that must open
Access, open a table within access, copy the contents of
said table, close Access and paste the information back
into Excel in exactly the same numerical and text format.
But its not recording the bit before the copy command...

A cool beer to the guys who helps me...

Gordon.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default How to access ACCESS from Excel!

There are examples for importing from Access at:
http://www.erlandsendata.no/english/...odao/index.htm

HTH,
Merjet


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default How to access ACCESS from Excel!


-----Original Message-----
There are examples for importing from Access at:
http://www.erlandsendata.no/english/...odao/index.htm

HTH,
Merjet

Hi...

The examples on that site are too specialist and look at
importing just 1 field from an access database into 1
column into Excel, when I have 20 to do. I'm also not
skilled enough to adapt that code. Any further help would
be grateful...

GC
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default How to access ACCESS from Excel!

Gordon,

Set a reference to the Microsoft ActiveX Data Objects library and use code
like the following:


Dim CN As ADODB.Connection
Dim RecSet As ADODB.Recordset
Dim DBName As String
Dim TableName As String
Dim StartCell As Range
'
' Change these there lines to the appropriate values.
'
DBName = "C:\Path\Database.mdb"
TableName = "TableName"
Set StartCell = Range("A1")

Set CN = New ADODB.Connection
CN.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & DBName & ";"
Set RecSet = New ADODB.Recordset
RecSet.Open "SELECT * FROM " & TableName, CN
StartCell.CopyFromRecordset RecSet
RecSet.Close
CN.Close



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Gordon Cartwright" wrote in message
...

-----Original Message-----
There are examples for importing from Access at:
http://www.erlandsendata.no/english/...odao/index.htm

HTH,
Merjet

Hi...

The examples on that site are too specialist and look at
importing just 1 field from an access database into 1
column into Excel, when I have 20 to do. I'm also not
skilled enough to adapt that code. Any further help would
be grateful...

GC



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
Query from Access into Excel cause Access to go to read only T Stephens Excel Discussion (Misc queries) 0 March 24th 09 04:17 PM
Can Excel access data from Access?! Al Excel Discussion (Misc queries) 5 April 5th 08 03:52 PM
Access Form In An Access Report (SubForm) Question Gary Links and Linking in Excel 0 January 27th 06 05:54 AM
Using Excel with Access petevang Excel Discussion (Misc queries) 0 August 30th 05 05:28 PM
export access to excel. change access & update excel at same time fastcar Excel Discussion (Misc queries) 0 June 24th 05 09:27 PM


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