Query a table from vba in Access

D

David Findlay

I have a table which contains some data i want to access in my VBA
module. I basically want to do the equivilent of the following SQL:

SELECT name FROM my_table WHERE id = foo;

How can I do that in the VBA code? Thanks,

David
 
C

Cindy M -WordMVP-

Hi David,
I have a table which contains some data i want to access in my VBA
module. I basically want to do the equivilent of the following SQL:

SELECT name FROM my_table WHERE id = foo;

How can I do that in the VBA code?
Set up a DAO or ADO connection to the database file, then create a
recordset. With DAO, this would mean a QueryDef on the table; with
ADO you should be able to make the SQL part of the command you use to
create the recordset.

If you need more help, you have to give more information, like the
application and the version in which you're writing the VBA code...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top