Query that returns Query Name

  • Thread starter Thread starter Kagsy
  • Start date Start date
K

Kagsy

Dear All

Is it possible to create a query that automatically returns the name of the
query to the query output along with other fields, e.g. QueryName:
ReturnThisQueryName? It would make life easier for someone who is asking for
my help.

Thanks

Alastair
 
If you already know the name of the query, you can simply add it to the
output fields, like so:
SELECT "qryMyQuery" As QueryName, Field1, Field2 FROM tblMyTable

If you're deriving the name of the query by some other means, then there
must be some point at which you're also deriving the name of the query
(probably in code). Therefoew, you can include the query name in much the
same way:
"SELECT '" & strQueryName & "' As QueryName, Field1, Field2 FROM
tblMyTable"

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Back
Top