Hi All,
Can't find the answer for this one but it is probably staring me in the face!
We are re-writing an application from Access 97 to Access 2003. The front end is access and the back end is SQL Server.
In the '97 version we create pass-though queries as the recordsource for our forms, use DAO, as follows:
Declarations:
Dim mysql as string
Dim dbs as database
Dim qdfname as querydef
mysql="select * from customers where cust_id=12345"
dbs.QueryDefs.Delete "Customers_qry"
set qdfname=dbs.CreateQueryDef("Customers_qry")
qdfname.sql=mysql
qdf.Connect="my connection string goes here"
qdfname.ReturnRecords=True
qdfname.close
dbs.close
Therefore on a customers form, the record source is a pass-through query running on the server with a where clause of the current customer id.
We are using ADO in Access 2003 so I am looking for a way to either re-create queries as above, or set the recordsource of a form dynamically using SQL generated in ADO (which may return more than one record).
Also, if it is possible to re-create querydefs, is it possible to create using a OLEDB connection rather than ODBC and also a connecvtion that does not require a DSN
Thanks in advance for any advice.
Can't find the answer for this one but it is probably staring me in the face!
We are re-writing an application from Access 97 to Access 2003. The front end is access and the back end is SQL Server.
In the '97 version we create pass-though queries as the recordsource for our forms, use DAO, as follows:
Declarations:
Dim mysql as string
Dim dbs as database
Dim qdfname as querydef
mysql="select * from customers where cust_id=12345"
dbs.QueryDefs.Delete "Customers_qry"
set qdfname=dbs.CreateQueryDef("Customers_qry")
qdfname.sql=mysql
qdf.Connect="my connection string goes here"
qdfname.ReturnRecords=True
qdfname.close
dbs.close
Therefore on a customers form, the record source is a pass-through query running on the server with a where clause of the current customer id.
We are using ADO in Access 2003 so I am looking for a way to either re-create queries as above, or set the recordsource of a form dynamically using SQL generated in ADO (which may return more than one record).
Also, if it is possible to re-create querydefs, is it possible to create using a OLEDB connection rather than ODBC and also a connecvtion that does not require a DSN
Thanks in advance for any advice.