Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

How read or write the Caption of table fields?

Discussion in 'Information Technology' started by Fjordur, Jul 28, 2006.

  1. Fjordur

    Fjordur
    Expand Collapse
    Guest

    Hi,
    I can't seem to find how to read / modify the Caption property of table
    fields from VB. Can it be done? How?
    For Each Fld In Tble.Fields
    Debug.Print Fld.Caption
    Next Fld
    gives me "Method or data member not found"...
    --
    Fjordur
     
  2. Loading...

    Similar Threads Forum Date
    Literature Has Anyone Read: "The Sikh Religion: Its Gurus, Sacred Writings And Authors" Language, Arts & Culture Oct 22, 2016
    Does Reading Baani Magically Affect Our Body And Psyche? And Does The Effect Depend On The Bani Read Intellectual Translations by SPNers Apr 30, 2016
    Sikhi Am I Ready To Take Amrit? Sikh Sikhi Sikhism Mar 10, 2016
    Emphasis When Reading Gurbani Intellectual Translations by SPNers Feb 14, 2016
    General Help! Looking for a good clairvoyant/card reader......any suggestions? Please Blogs Jan 25, 2016

  3. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    Several of these properties do not exist if you have nothing in the
    property. That's true for the Description of the field, and other properties
    too.

    You can use a function with error handler to see if the property exists:

    Public Function HasProperty(obj As Object, strPropName As String) As Boolean
    'Purpose: Return true if the object has the property.
    Dim varDummy As Variant

    On Error Resume Next
    varDummy = obj.Properties(strPropName)
    HasProperty = (Err.Number = 0)
    End Function

    Or you can just use error handling in your code to recover from the error.
    This example illustrates how to do that with the field Descriptions:
    http://allenbrowne.com/func-06.html

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "Fjordur" <someone@microsoft.com> wrote in message
    news:446d9488$0$7997$626a54ce@news.free.fr...
    > Hi,
    > I can't seem to find how to read / modify the Caption property of table
    > fields from VB. Can it be done? How?
    > For Each Fld In Tble.Fields
    > Debug.Print Fld.Caption
    > Next Fld
    > gives me "Method or data member not found"...
    > --
    > Fjordur
     

Share This Page