Retreiving SQL statement of a query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Im trying to write code that looks like this in Pseudocode below. Im not to
sure how to retreive the SQL statement of a query in an if statement. Thanks
to those who can help.



If the query "Monthly Certificate - 4500/4600 Face" has the string
"((dbo_gltnrpt.trans_dt)>#12/18/2006#))" in its SQL statement somewhere then

Do whatever

End if
 
If you are working in VBA, you can:
point to an existing query
use something like
strYourSQL = YourQueryDef.SQL
to get the text of the SQL statement of the query.

(If that didn't come through clearly, that is the .SQL property ("dot SQL"))

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
tanhus said:
Im trying to write code that looks like this in Pseudocode below. Im not to
sure how to retreive the SQL statement of a query in an if statement. Thanks
to those who can help.



If the query "Monthly Certificate - 4500/4600 Face" has the string
"((dbo_gltnrpt.trans_dt)>#12/18/2006#))" in its SQL statement somewhere then

Do whatever

End if


In DAO it would be:

If CurrentDb.QueryDefs("Monthly Certificate - 4500/4600
Face").SQL Like
"*"((dbo_gltnrpt.trans_dt)>[#]12/18/2006[#]))*" Then
 
Back
Top