Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 355
Default Import Data from an Access DB with VBA

Is there a primer on how to do this? I want to import specific ranges of
records from an access table.

Thanks,

Sandy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Import Data from an Access DB with VBA


The best thing to do is to get a good book on Access VBA. The Access VBA
commands can be used in Excel VBA with a few minor changes. Depending on the
version of Access you are using depends on which commands will work. Access
is not like Excel that most commands will work in any version of Excel. With
Acces you can use the Microsoft Jet engine or use ADO or DAO methods
depending on how the database was created.

1) In Excel declare an Access Application

Set obj = CreateObj("Access.Application"). the include obj in front of the
Access commands yo get from the book.

2) In excel specify a reference to Access by going to the following menu

Tools - References - Microsoft Access 11.0 Object Library

3) Depending on the methods you use in Accdess you may have to add the
Active X library object to your project

Tools - References - Microsoft ActiveX Data Objects 2.8 Library


The two tricks I use is to Reference the Access VBA help for finding
methods. There are a lot of good examples in the Access VBA Help. I also
use the Excel macro recorder and first try to record will performing the
following actions in excel

From worksheet menu in excel : Data - Import External Data - Import Data (or
new web query) and select the Access Source File.

The last menu (the one with finish) has an option to edit the query where
you will see the SQL statements for the query. The "Command Text" portion of
the recorded macro is the SQL statements and can be edited as required. If
you have experience writing SQL statements the task should be pretty simple
once you have the recorded macro to get you started.

"Sandy" wrote:

Is there a primer on how to do this? I want to import specific ranges of
records from an access table.

Thanks,

Sandy

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
Import Data from Access toby131 Excel Discussion (Misc queries) 3 October 27th 09 11:47 PM
Can't import data to access Amin Excel Discussion (Misc queries) 3 September 26th 08 04:56 AM
Import - Access Data through ADO Anant Basant Excel Programming 3 November 27th 06 02:30 PM
Import Data From Access! Please Help!! greenfalcon[_10_] Excel Programming 1 July 10th 06 08:28 PM
Import Data from Access via DAO LHC01 Excel Programming 3 August 12th 04 11:24 AM


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