troubleshooting Question Get Access Table columns in order they are in in the table

Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft AccessVisual Basic.NET
2 Comments1 Solution668 ViewsLast Modified:
I am trying to get the columns in an Access table in the order that they are in in the table rather than in alphabetical order, that is given using GetOleDbSchemaTable.
How do I loop through DataRowArray in the following code to get through this? If there is a better way t'hen that would be great. Thanks

                'Get the column names in the table.
                Dim SchemaColumn = cn.GetOleDbSchemaTable(schema:=OleDbSchemaGuid.Columns, _
                restrictions:=New Object() {Nothing, Nothing, TableName, Nothing})

                Dim DataRowArray() As DataRow = SchemaColumn.Select(Nothing, "ORDINAL_POSITION", DataViewRowState.CurrentRows)
Robert Schutt
Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros