Help: Access 2.0 Function does not work with VB 3.0 
Author Message
 Help: Access 2.0 Function does not work with VB 3.0

HI
please look at the function below (use cut and paste!)
I could not found how to access field descriptions with VB 3.0
It workes fine with Access 2.0 !!!
Any Idea ?
Hans

Function test ()
' This ACCESS 2.0 Function shows for all Tables Fields Names AND Field
DESCRIPTIONS !!!                                            
' Problem: it does not work with Visual Basic 3.0 (prof. version)
' the line:  text =db.tabledefs(i).fields(j).properties("description")
' does not work (VB 3.0 prof. version)

Dim db As Database
' If Visual Basic the use next line
' set db = opendatabase ("C:\....")
' if Visual Basic then comment out next line
Set db = CurrentDB()
For i = 0 To db.tabledefs.count - 1
If (db.tabledefs(i).Attributes) = 0 Then
  Debug.Print "Table:", db.tabledefs(i).name
  For j = 0 To db.tabledefs(i).fields.count - 1
    text = db.tabledefs(i).fields(j).properties("description") If
    Not IsNull(text) Then
       Debug.Print db.tabledefs(i).fields(j).name, text
    End If
  Next j
End If
Next i
End Function



Fri, 06 Nov 1998 03:00:00 GMT  
 Help: Access 2.0 Function does not work with VB 3.0

Hans,

I haven't actually looked at your code but if you want a function to return the description of
a field you can use this function.

Function GetFieldDescription(ByVal TableName As String, ByVal FieldName As String)

  Dim Db As Database
  Dim Td As TableDef
  Dim Fld As Field

  On Error GoTo errGetFieldDescription

  Set Db = DBEngine.Workspaces(0).Databases(1)

  Set Td = Db.TableDefs("mp" + TableName)
  Set Fld = Td.Fields(FieldName)

  GetFieldDescription = Fld.Properties("Description")

EndGetFieldDescription:
  Exit Function

errGetFieldDescription:
  GetFieldDescription = Null
  Resume Next
  Resume EndGetFieldDescription

End Function

Hope this helps

Fergal Moran.



Sun, 08 Nov 1998 03:00:00 GMT  
 Help: Access 2.0 Function does not work with VB 3.0

Ammendment to last mail

the line   Set Td = Db.TableDefs("mp" + TableName)
should read   Set Td = Db.TableDefs(TableName)

Sorry but it's a throwback from the app I copied it from.



Sun, 08 Nov 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Access 2.0 VB 3.0 compact/repair not working

2. Install Access 2.0 Cmpt Layer w/o Access 2.0 for VB 3.0

3. How do I get VB 3.0 Pro to work with Access 2.0

4. Help : VB 3.0 not compatible with MS A 2.0

5. VB 3.0, Access 2.0 and Crystal Reports 2.0

6. Help: VB 3.0/Access 1.1/ 2.0 with Office 97

7. Help with Access 2.0 and VB 3.0

8. HELP: Access 2.0 corruption with VB 3.0

9. Help need VB 3.0 Access 2.0 drivers

10. help, vb 3.0 accessing acces 2.0?

11. Need help converting from Access 2.0 to VB 3.0

12. Help with VB 3.0 and Access 2.0

 

 
Powered by phpBB® Forum Software