Query to return field names from table

B

BlueWolverine

Hello,
MS ACCESS 2003 on XP PRO.

I want to write a query that will return the field names from a table/query.

I found

<<<
SHOW COLUMNS FROM 'TABLE';
on a MYSQL google search but this does not work in Access.

How can I do this in Access?
Thanks.
 
J

John Spencer

You can try the following untested query

SQL to List FieldNames for a query. Doesn't work for a table.

SELECT MSysQueries.Expression
FROM MSysObjects INNER JOIN MSysQueries ON MSysObjects.Id =
MSysQueries.ObjectId
WHERE (((MSysObjects.Name)="qryCustDetails") AND
((MSysQueries.Expression)<>""));

For a table, you can either construct a query and save it or use a
custom VBA function.
'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top