Table Description

  • Thread starter Thread starter John Clayton
  • Start date Start date
J

John Clayton

If you right click an Access Table name you get the
Properties dialog. In this dialog is a box called
Description: which allows the user to input a description.

How do I input a description into this box using Visual
Basic 6 and DAO?

I have been trying to create a property and append it to
the table, which seems to work when I enumerate the
property.name.

But this does not give me the description, this is
obviously not what I want to achieve.

Can anybody help?
 
Description is not a built-in property, so if it doesn't exists you will
need to create it. For example:

Sub TableDescription()
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim prp As DAO.Property

Set db = CurrentDb
Set tdf = db.TableDefs("Customers")

On Error GoTo err_TableDescription
tdf.Properties("Description") = "Testing..."

Set tdf = Nothing
Set db = Nothing
Exit Sub

err_TableDescription:

If Err.Number = 3270 Then 'no such property
Set prp = tdf.CreateProperty("Description", dbText, "Testing...")
tdf.Properties.Append prp
Set prp = Nothing
Else
MsgBox Err.Number & ": " & Err.Description
End If
Resume Next

End Sub

This example is for using in an mdb file. If you are using VB 6 you will
need to create a database object rather than use the CurrentDb function.

HTH
 
Back
Top