Connect to ODBC from Access (Newbie)
I am spreading my wings into ODBC but need a kick-start. I have the SQL for the query and have ODBC installed (it works in Excel; that's how I got the SQL for the query). I need to know how to connect to the database from Access and开发者_运维百科 pull the data into my table. Can someone please help with that?
Thank you,
Dave
Do you wish to use Excel data in Access? If so, simply link the spreadsheet (External Data).
EDIT
You can also link tables from other Access databases to easily create queries in the Query Design Window.
DAO is native for Access, here are a few notes:
Dim db As Database
Dim rs As DAO.Recordset
Set db = OpenCurrentDatabase("c:\docs\MyDb.mdb")
Set rs= db.OpenRecordset("Select Field From Table")
db.Execute "Update Table Set Field=2", dbFailOnError
I don't have MSAccess installed on this machine, so I might have the menu names incorrect.
If I understand correctly you're just trying to get MSAccess to connect to an ODBC database.
Go to the Main menu. Select "File"/"External Data"/"Link" ...
A wizard will step you through the connection set-up and show you the tables available in the database you're connecting to.
Once you've selected all the tables you want to work with, Access imports the definitions and they behave mostly like the local tables.
also see
http://www.aspfree.com/c/a/Microsoft-Access/Importing-Data-into-MS-Access-with-ODBC/1/
精彩评论