Access 2000 Field Description

Access 2000 Field Description

Post by Phil Chapma » Thu, 29 Mar 2001 01:00:46



When designing a table in Access 2000 you define the Field Name, Data Type and a
space is provided to provide a Description of the field.

I'm needing the be able to view this field description field using VB6.  Any help
would be appreciated.

Thanks,
Phil

 
 
 

Access 2000 Field Description

Post by Carl Peter » Thu, 29 Mar 2001 03:19:17


The string you're looking for is a property available in the DAO object library.  
However, the property is only available if it has been used, so trying to read it
in those cases will generate an error.  If you set your VB options to "Break on
Unhandled Errors", then the following snippet should print all of the
descriptions in a particular database to the immediate window.
(replace "C:\Data\Access\contacts.mdb" with the name and path of the database
you're trying to use)

Sub PrintDescription()
   Dim wrkDefault As DAO.Workspace, dbTest As DAO.Database, _
    tblCurrent As DAO.TableDef, fldCurrent As DAO.Field
    Set wrkDefault = DBEngine.Workspaces(0)
    Set dbTest = wrkDefault.OpenDatabase("C:\Data\Access\contacts.mdb")
    For Each tblCurrent In dbTest.TableDefs
        For Each fldCurrent In tblCurrent.Fields
            On Error Resume Next
            Debug.Print fldCurrent.Properties("Description")
        Next fldCurrent
    Next tblCurrent
End Sub

Quote:-----Original Message-----

When designing a table in Access 2000 you define the Field Name, Data Type and a
space is provided to provide a Description of the field.

I'm needing the be able to view this field description field using VB6.  Any help
would be appreciated.

Thanks,
Phil


 
 
 

Access 2000 Field Description

Post by Carlos J. Quinter » Thu, 29 Mar 2001 17:05:34


You can use:

Dim sMsg As String
Dim objField As Field
...
Set objRecordset = objADOConnection.OpenSchema(adSchemaColumns, Array(Empty,
Empty, "MyTable"))
Do While Not objRecordset.EOF
   sMsg = ""
   For Each objField In objRecordset.Fields
      sMsg = sMsg & objField.Name & " = " & CStr("" & objField.Value) &
vbCrLf
   Next
   MsgBox sMsg
   objRecordset.MoveNext
Loop
objRecordset.Close

There is a Field in the recordset ("DESCRIPTION") that gives you that info.

Another approach is to use ADOX.

--
Best regards,

Carlos J. Quintero

MZ-Tools 2.0 (New version) freeware 'all-in-one' Add-In for VB6: Task List,
Line Numbering, TabIndex Assistant, Procedure Callers, Find and Replace in
All Projects, Close Windows, Review TabIndex and Collections, Add Procedure,
Add Error Handler, Add Procedure or Module Header, Clear Immediate Window,
Statistics, Copy/Paste/Rename/Remove controls with code, Default Controls
Properties and more:
www.mztools.com



When designing a table in Access 2000 you define the Field Name, Data Type
and a
space is provided to provide a Description of the field.

I'm needing the be able to view this field description field using VB6.  Any
help
would be appreciated.

Thanks,
Phil

 
 
 

1. Access 2000 ADOX schema/ Table Field Descriptions

I have serveral Access 2000 databases that I'm importing
into SQL 7 with one problem. I extensively use the schema
object in asp which uses the description column in access
2000 i.e. field_name data_type description.  I have not
found how SQL 7 handles or if it does the "description"
from Access.  I noticed in SQL 7 that you can import the
metadata and see the descriptions associated with Access
field names but I've yet to figure out on how to import
them into SQL7 if it supports it.

Please advise.

2. Any Offers???

3. Field Description In SQL 2000

4. $$$$$$$$$$$$seen the rest now try the best$$$$$$$

5. Column Description Field in MS SQL Server 2000

6. Async call from VB3 in WIN95?

7. Import Access Field Descriptions

8. Bind from program ?

9. How To? Access vs SQL Server Description Field

10. Populating MS Access field description

11. How to get Access Field descriptions using ADO?

12. Reading the Access Description for a field in VB6