H
Helge V. Larsen
I have written some VBA that (among other things) writes the SQL statements
associated with all queries in an Access database to a text file. The SQL is
retrieved in this way:
For Each aQueDef In CurrentDb.QueryDefs
aSQL = aQueDef.SQL
' Write SQL to text file
Next aQueDef
However, there is sometimes an error in the reported SQL:
If a field name in a table is changed, then the SQL (as reported by my VBA)
associated with a query that draws on this table is NOT updated accordingly.
The old field name is still used!
If I open the query (in design mode or in 'data' mode) and close it again
without being asked weather to save it or not, then the SQL of the query is
reported correctly by my VBA.
How can I in VBA or in another way do this update/refresh of the SQL ?
associated with all queries in an Access database to a text file. The SQL is
retrieved in this way:
For Each aQueDef In CurrentDb.QueryDefs
aSQL = aQueDef.SQL
' Write SQL to text file
Next aQueDef
However, there is sometimes an error in the reported SQL:
If a field name in a table is changed, then the SQL (as reported by my VBA)
associated with a query that draws on this table is NOT updated accordingly.
The old field name is still used!
If I open the query (in design mode or in 'data' mode) and close it again
without being asked weather to save it or not, then the SQL of the query is
reported correctly by my VBA.
How can I in VBA or in another way do this update/refresh of the SQL ?