C
Christine
It has come to my attention that sometimes, when I open a Query in SQL
View, the SQL that I see is not exactly the same as the SQL in the
Query's Querydef. The difference I see (only occasionally) has to do
with square brackets and dot on some tblName.FieldName portions of the
query.
The following routine demonstrates how I see the QueryDef's SQL:
Sub DbgQuery(sQryName As String)
'' Prints the SQL for the given query to the Debug Window
Dim qdf As DAO.QueryDef
Set qdf = CurrentDb.QueryDefs(sQryName)
Debug.Print qdf.SQL
Set qdf = Nothing
End Sub
I have some VBA code that compares queries of the same name accross
different mdb's and have come across some instances where the SQL is
identical when I view it in the SQL View of the Query, but my Compare
code is picking up differences. In each of these cases, the VBA is
showing extra brackets, but I cannot see it in the SQL View and thus
they look the same.
Has anyone ever observed this before? Is there any way I can get
'identical Queries' to look the same via VBA? I am so surprised that
the SQL View does not match the QueryDef.SQL. I've been comparing
queries across mdbs like this for months and had not seen this before,
and now suddenly, four or five of them have developed differences as a
result of the brackets! I am quite dependent on my compare technique
and this new quirk is posing me a real challenge.
Any comments or insights greatly appreciated.
TIA,
Christine
View, the SQL that I see is not exactly the same as the SQL in the
Query's Querydef. The difference I see (only occasionally) has to do
with square brackets and dot on some tblName.FieldName portions of the
query.
The following routine demonstrates how I see the QueryDef's SQL:
Sub DbgQuery(sQryName As String)
'' Prints the SQL for the given query to the Debug Window
Dim qdf As DAO.QueryDef
Set qdf = CurrentDb.QueryDefs(sQryName)
Debug.Print qdf.SQL
Set qdf = Nothing
End Sub
I have some VBA code that compares queries of the same name accross
different mdb's and have come across some instances where the SQL is
identical when I view it in the SQL View of the Query, but my Compare
code is picking up differences. In each of these cases, the VBA is
showing extra brackets, but I cannot see it in the SQL View and thus
they look the same.
Has anyone ever observed this before? Is there any way I can get
'identical Queries' to look the same via VBA? I am so surprised that
the SQL View does not match the QueryDef.SQL. I've been comparing
queries across mdbs like this for months and had not seen this before,
and now suddenly, four or five of them have developed differences as a
result of the brackets! I am quite dependent on my compare technique
and this new quirk is posing me a real challenge.
Any comments or insights greatly appreciated.
TIA,
Christine