Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access Field Description Property in VB 6.0

Status
Not open for further replies.

ufobaby

MIS
Sep 25, 2001
238
US
How do i retrive a Field Description property text in VB 6.0 code. Also need to retrive the Tables Description Property.

Specifics
----------
.] MS Access 97 Database
.] These properties are set in the database alreaady.

PLS THIS IS URGENT

Cheers !!!!
Niraj
 
Okay,

Good News and Bad News ...

Bad News

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

End Function


Hope the urgency will soon be complacent.

Ciao
Phathi. >:):O>
 
Phathi,

Thanksssssss a ton. This is excellent. Also got how to find the Tables description Property.

VarDesc = db.TableDefs(TABLE).Properties("Description").Value

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(....).

Thanks a ton once again
Cheers !!!!
Niraj >:):O>
 
Hi Niraj,

Here goes


Public Sub OpenWithoutSchema()

Dim rs As ADODB.Recordset

Set rs = DAOconn.OpenSchema(adSchemaTables)

Do Until rs.EOF
If Not rs!TABLE_TYPE = "SYSTEM TABLE" Then
'use table to heart's content

rs.MoveNext
Else
'skip as this is schema
rs.MoveNext
End If
Loop

rs.Close
Set rs = Nothing

End Sub


something like that, I haven't tried this, so feel free to make it actually work.

Ciao
Phathi. >:):O>
 
hi,

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 &quot;NOT ZERO &quot; & 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 = &quot;SQL stmt.&quot;
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.

Cheers!!!
Niraj >:):O> E-mail:- kniraj@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top