As far as I know, you cannot find the description property using ADO... some shmuck decided that people don't use this anymore (and some other shmuck backed him by putting descriptions in right-click in Access 2000).
Good News
DAO is NOT DEAD... you can get the property by opening a recordset. Assumption: you have a database object open.
cut and paste
Function GetFieldDescription(inTableName As String, inFieldName As String) As String
Dim Sna As Recordset
Dim i As Integer
GetFieldDescription = ""
Set Sna = DAOconn.OpenRecordset(inTableName, dbOpenTable)
For i = 0 To Sna(inFieldName).Properties.Count - 1
If Sna(inFieldName).Properties(i).Name = "Description" Then
GetFieldDescription = Sna(inFieldName).Properties("Description"
Exit For
End If
Next
But if we use this in a loop for TableDefs it gives some system tables maintained by Access Starting wiht MSys. Do you know some way of avoiding this other than taking MID(....).
Found a way to avoid "MSys" tables using DAO.
Set MDB = OpenDatabase(App.path & "\db1.mdb"
Dim ctr As Integer
ctr = 0
Do While MDB.TableDefs.Count <> ctr
If MDB.TableDefs(ctr).Attributes = 0 Then
'//// THESE ARE THE TABLES WE WANT
MsgBox MDB.TableDefs(ctr).Name
Else
'//// THESE ARE THE 'MSys' TABLES
MsgBox "NOT ZERO " & MDB.TableDefs(ctr).Name
End If
ctr = ctr + 1
Loop
'============== ;-) One more help ====
I have posted a question for Help with DBGrid. I run a query by using
DataControl.Recordsource = "SQL stmt."
DataControl.Refresh
DBGrid.Reresh '//// This DBGrid is bound to DataControl.
Now i check if no rows are returned. if so then the DBGrid should show two empty columns like it does when placed on the form.
I use ClearFields method to di this but it does not work. It just shows all the headings from the query.
Can u put ur Expertise on this please.
Again very URGENT.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.