Link to home
Start Free TrialLog in
Avatar of Ross Temple
Ross Temple

asked on

Retrieving data from a MS Access table using Python

I have a table TABLEAA in a MS Access database and I want to retrieve the data into some Python code.

I can connect to the database using win32com and run a query (SELECT, Z00, Z01, Z02, Z03 FROM TABLEAA) but how do I then refer to Z00, Z01 etc in the Python code? Here is my sample code...

import win32com.client
from win32com.client import Dispatch

strDbName = r'C:\\Users\Ross\Documents\TESTDB.mdb'
objAccess = Dispatch("Access.Application")
objAccess.OpenCurrentDatabase(strDbName)

objAccess.DoCmd.OpenQuery('AAQUERY')
SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Why aren't you using PyODBC, or similar?
Avatar of Ross Temple
Ross Temple

ASKER

OK, could you (or anyone else) post some sample code to return and query a recordset?

Thanks.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
solutions provided by experts