D DVN Mar 3, 2004 #1 How do you write code to read a query's SQL lines and store it into a string variable? Thanks for your help.
How do you write code to read a query's SQL lines and store it into a string variable? Thanks for your help.
R Roger Carlson Mar 3, 2004 #2 With DAO, you can do this: Dim varQDef As QueryDef Dim strSQL As String Set varQDef = CurrentDb.QueryDefs("TheQuery") strSQL = varQDef.SQL 'Remove carriage return line feed and the semi colon from the end of the string. strSQL = Left(strSQL, Len(strSQL) - 3)
With DAO, you can do this: Dim varQDef As QueryDef Dim strSQL As String Set varQDef = CurrentDb.QueryDefs("TheQuery") strSQL = varQDef.SQL 'Remove carriage return line feed and the semi colon from the end of the string. strSQL = Left(strSQL, Len(strSQL) - 3)
M Marshall Barton Mar 3, 2004 #3 DVN said: How do you write code to read a query's SQL lines and store it into a string variable? Click to expand... strSQL = CurrentDb.QueryDefs("queryname").SQL
DVN said: How do you write code to read a query's SQL lines and store it into a string variable? Click to expand... strSQL = CurrentDb.QueryDefs("queryname").SQL