What's the most efficient way of enumerating the fields of an Access RecordSource? -


the recordsource access form or report can table or query. table can local or linked (and might contain calculated fields), , query can refer other queries , other tables. furthermore, query can use "*" selections, user-defined functions (udfs) , remotely connected sources. crosstab queries can have field names determined values within fields, , such, crosstab field names can vary data changes.

i'm trying find the efficient "light-touch" way of determining field names of given recordsource, following considerations:

  • queries include user-defined functions should not call functions while determining field names, recordset approach not suitable.

  • locks should not put on underlying objects

  • the database ideally not in exclusive mode

  • connections linked tables should ideally not opened, , nor should triggers on remote tables triggered. if possible fields should determined without access remote data sources.

  • the field name required, field type , attributes nice have. field description bonus.

  • i fear crosstab queries potentially open underlying tables and/or run udfs (as have in testing), prepared skip enumerating fields of crosstab query, although won't know if query has source crosstab query...

i'm unsure if using daos tabledef , querydef adequate, or whether should explore ado schemas , catalogs, or perhaps other approach?

this basic dao approach, i'm not convinced fastest, or if light-touch.

sub enumquerydeffieldnames()    dim qdf querydef   set qdf = currentdb.querydefs("query7_crosstab")   each fld in qdf.fields     debug.print fld.name   next fld  end sub 

tabledef , querydef usual objects this. simple , fast.

of course, crosstab need retrieve data determine field names, except (perhaps, haven't tested) if these hardcoded.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -