Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2004
    Posts
    104

    Unanswered: Refer to field Property from a variable

    I have a string variable that contains a table name and one of its field like "table.field". This format is same as is in the SELECT clause.I want to refer and pick the caption property of this field.How? I know that if I had the table name and the field name not in a variable then this job would be easy but the contents of variable are changing each time (the variable is an array type which contains several tables with their fields).I think that it is extremely difficult. Is there someone who can solve this problem?
    Thanks

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Fields don't have captions... ?

    Do you intend to rename the label associated with a control?

    Call the label directly and set its caption property to whatever you'd like.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Feb 2004
    Posts
    104
    Sorry but there is a caption property in fileds.See the properties for its field in a design view table.Then you will see this property but the problem is more general. Don't focus on specific situasion. For example as we suppose that in the variable we have the name of an object and we want to be reported in one of its property. How?

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Quote Originally Posted by NonLinear
    I have a string variable that contains a table name and one of its field like "table.field". This format is same as is in the SELECT clause.I want to refer and pick the caption property of this field.How? I know that if I had the table name and the field name not in a variable then this job would be easy but the contents of variable are changing each time (the variable is an array type which contains several tables with their fields).I think that it is extremely difficult. Is there someone who can solve this problem?
    Thanks
    Do you want to get the Field names in an Query?

  5. #5
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    If you use QueryDef you will be able to go through the collection and get the fields' names

    PHP Code:
      Dim qdfTemp As QueryDef,  fld As Field

          Set qdfTemp 
    db.CreateQueryDef("anyQureyName""SELECT * FROM yourTable")  
      
        For 
    Each fld In qdfTemp.Fields
             MsgBox
    (fld.Name' Gives the Field Name of the Query
        Next fld 

  6. #6
    Join Date
    Feb 2004
    Posts
    104
    No I am sorry. I don't want the name of the field. I WANT THE CAPTION PROPERTY that I wrote when the field was created in an Access table. Note that the filed's and its table's name is in a string variable.
    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •