Results 1 to 8 of 8

Thread: Fields' Names

  1. #1
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Unanswered: Fields' Names

    Hello there,
    when I use Adox to get the fields' names and put them in a list box, I get them sorted.
    I need them unsorted

    Here is the code I use
    ]

    PHP Code:
        Set cat.ActiveConnection MyConn     'CurrentProject.Connection
        cat.Tables.Refresh
        Set tbl = cat.Tables(Trim(myTablename))   ' 
    Trim was very important 
        
            
    For Each col In tbl.Columns         'Loop through the tables' columns 
                MyListBox
    .AddItem col.Name
            Next 
    Last edited by loquin; 11-23-08 at 15:33. Reason: There's really no need to shout...

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Can I ask why you require them to be un-sorted? This is a very bizarre request indeed!

    Is this MSAccess btw?
    George
    Home | Blog

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Thank you for your answer,
    When the fields are sorted, I get unimportant fields at the begin of the listbox,
    then to search about 70 fields for the suitable filed, is a nice job. isn't it....
    Last edited by loquin; 11-23-08 at 15:34.

  4. #4
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    70 fields is a lot for a normalized table structure...
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  5. #5
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Quote Originally Posted by loquin
    70 fields is a lot for a normalized table structure...
    But this answer helps not....

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You may have better luck using IColumnsInfo from OLEDB as opposed to an ADOX catalog:

    http://msdn.microsoft.com/en-us/libr...04(VS.85).aspx
    oh yeah... documentation... I have heard of that.

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

  7. #7
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Thank you for your answer, hope I can find an example there.

  8. #8
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Quote Originally Posted by hammbakka
    But this answer helps not....
    but, still true. Often, when large numbers of fields are used, the table is improperly designed. Not always, but, often.

    ***
    You can easily fetch the unsorted column list by using ADO.

    Code:
    rs.Open "Select * From YourTable Where True = False", cn
    
    For N = 0 to rs.Fields.count-1
      debug.Print Field(N).Name
    Next N
    
    rs.close
    set rs=nothing
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

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