get query field properties in vba

Y

YisMan

hi, everyone
id like to return the name and such of all fields in a query.
ive researched the adox.command properties and have not found any help
can anybody help me with this one?
 
O

Ofer Cohen

Try this function, pass to it the name of the query

Function GetFieldName(QueryTableName As String)
Dim R As DAO.Recordset
Dim j As Long

Set R = CurrentDb.OpenRecordset( _
"SELECT * FROM " & QueryTableName & " WHERE FALSE", dbOpenSnapshot)
For j = 0 To R.Fields.Count
Debug.Print j, R.Fields(j).Name
Next
R.Close

End Function
 
Y

YisMan

Todah
i was aware of the DAO option. I am looking if possible to do it with ADO/ADOX
probably with the ADOX.command property
please advise
 
O

Ofer Cohen

מצטער
Sorry it took me a while to answer, I don't have an answer for that, mybe
start a new thread, I'm sure you'll get an answer from somebody else.
 
Top