sql - Get field description from a query in vba -


i'm developing function data query. want have both field name (same db) , field description before data. found how field name did not find way description, can me?

this current code field name (and how tried description commented):

'-get table's data set rs = con.execute("select * " & sh.name)  '-set name of fields dim thecells range set thecells = sh.range("a2") = 0 rs.fields.count - 1     thecells.offset(0, i).value = rs.fields(i).name     'thecells.offset(1, i).value = rs.fields(i).properties("description").value next 

you can use adox properties of columns.

sub getfielddesc()      dim axcat adox.catalog     dim axtbl adox.table     dim adcon adodb.connection     dim axprop adox.property      'create ado connection     set adcon = new adodb.connection     adcon.open scon      'point adox catalog connection     set axcat = new adox.catalog     set axcat.activeconnection = adcon      'pick table     set axtbl = axcat.tables("tblcurrentpricedate")      debug.print axtbl.columns(0).properties("description").value  end sub 

set reference activex data objects , ado ext. x.x dll , security


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -