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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS ACCESS and ADOQuery

Status
Not open for further replies.

Ginka

Programmer
Mar 18, 2005
54
MX
Is there a way to execute a query that is into MS ACCESS and bring back the result into a ADOQuery???


I need it this way because using access you can add some visual basic code to the MS Access query

 
I use this method to make connect with MSACCESS (MDB):

1) create file with any name, for exsample datasource.dsn
This data of file:
[ODBC]
DRIVER=Microsoft Access Driver (*.mdb)
UID=
UserCommitSync=Yes
Threads=3
SafeTransactions=0
ReadOnly=1
PageTimeout=5
MaxScanRows=8
MaxBufferSize=2048
FIL=MS Access
Exclusive=0
DriverId=281
DefaultDir=//Here must be the dir with mdb file
DBQ=//Here full path to mdb file
2)After Add one TADOConnection and set
ADOConnection1->ConnectionString="FILE NAME=/*path to file*/DataSource.dsn";
ADOConnection1->Open();
3)Add TAdoDataSet and set: AdoDataSet1->Connection=AdoConnection1;
4) Use AdoDataSet1->CommandText for write SQL
5) AdoDataSet1->Open or AdoDataSet1->Active=1 to Open:)
 
Thanks for your help, but I don't have problems with the connection, what I need is to execute a query that is into MS ACCESS
 
Have you tryed to use a simple SQL statement inside a TADOQuery eg

select * from [QueryName]

unless I am not understanding your question fully, this will return a result set.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top