Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to connect to a database in Excel

Status
Not open for further replies.

kchan

Programmer
Sep 1, 2001
8
GB
Hi

I am using Excel 2000 to connect to a database using VBA, which object/method would I need to use to achieve this?
and which object/methods do I need to use to pull the data out? Actually is this possible with Excel VBA?
 
You may play with QueryTables (menu Data -> External data -> ...) or with Recordset (either DAO or ADODB).

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
what I really want to do is to code it with VBA where I can query the database and then drop the result into a worksheet, so with recordset I can achieve this?
 
yes - and querytables

probably the easiest way to get started is to record yourself setting up a new querytable:

Data>Import External Data>New Database Query

Have a go and post back if you have any specific issues

Rgds, Geoff

Three things are certain. Death, taxes and lost data. DPlank is to blame

Please read FAQ222-2244 before you ask a question
 

I do as both PHV & xlbo have suggested, WITH and WITHOUT code almost EVERY DAY.

Turn on that macro recorder and have at it!

Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top