A
alekm
Hi,
how can I reach a query that exists in my access db, eg "simpleSql", from
code.
Thanx
alek_mil
how can I reach a query that exists in my access db, eg "simpleSql", from
code.
Thanx
alek_mil
alekm said:Hi,
how can I reach a query that exists in my access db, eg "simpleSql", from
code.
Thanx
Ah, now you didn't ask that ;-)alekm said:Ok, that's the way to execute query but how can I reach it's content, eg
Select * from .....
thanx
alek_mil
alekm said:I did not put question right I guess.
There is a query 'X' in my database. How can I get it's sql from code?
Furthermore, how can I change it's sql from code?
Douglas J Steele said:Dim qdfCurr As DAO.QueryDef
Dim strSQL As String
Set qdfCurr = CurrentDb().QueryDefs("X")
strSQL = qdfCurr.SQL
will give you the SQL associated with a query.
Dim qdfCurr As DAO.QueryDef
Dim strSQL As String
strSQL = "SELECT Field1...."
Set qdfCurr = CurrentDb().QueryDefs("X")
qdfCurr.SQL = strSQL
will let you change it.
Douglas J Steele said:Dim qdfCurr As DAO.QueryDef
Dim strSQL As String
Set qdfCurr = CurrentDb().QueryDefs("X")
strSQL = qdfCurr.SQL
will give you the SQL associated with a query.
Dim qdfCurr As DAO.QueryDef
Dim strSQL As String
strSQL = "SELECT Field1...."
Set qdfCurr = CurrentDb().QueryDefs("X")
qdfCurr.SQL = strSQL
will let you change it.
(NOTE: This assumes you have a reference set to DAO. If you're using Access
2000 or 2002, you may have to add that reference)
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.