Results 1 to 3 of 3

Thread: TableDef (A2K)

  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    TableDef (A2K)

    Good Morning,

    So glad to see you back!!!

    I need to run a process with certain fields from a specific table. I thought the best approach was to create a collection using tableDefs and am way out of my league here but giving it a shot anyway.

    The only fields I need to run this process on within the table are the fields that have "HEX" in it's description. There are 13 of them. I'm going to apply this collection to an array statement.

    I have the following code:
    <pre>Public Sub DefHex()
    Dim dbs As DAO.Database
    Dim tdf As DAO.TableDef
    Dim FLD As DAO.Field
    Dim fldSearch As String
    Dim v As Variant

    Set dbs = CurrentDb
    Set tdf = dbs.TableDefs("tPDE")

    fldSearch = "Hex"

    For Each FLD.Properties("Description") In tdf.Fields
    If FLD.Properties("Description") = fldSearch Then
    v = 1
    End If
    Next

    Debug.Print v
    End Sub</pre>


    However, when I attempt to run it, I recieve the following error:
    <hr>Variable required-Can't assign to this expression<hr>
    Again, I know I'm way out of my league here, but feel I've very close. If someone could shed some light (in simple terms), I would certainly appreciate it.

    As for the array, I have most of the code.

    Thanks in advance.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: TableDef (A2K)

    Try changing

    For Each FLD.Properties("Description") In tdf.Fields

    to

    For Each FLD In tdf.Fields

  3. #3
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: TableDef (A2K)

    Thanks Hans that did it. Much appreciated.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

Posting Permissions

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