473,803 Members | 2,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fields in Access database returned in alphabetical order

I'm using the following VB.Net code to retreive the field names of a table
in an Access db:

Dim NewField As ADOX.Column
Dim tblField As ADOX.Column

For Each tblField In adocat.Tables(" tblData").Colum ns
The fields are returned in alphabetical order! I want to have the fields
returned in the order they were created. Can this be done?

-Julian

Mar 11 '06 #1
5 3231
"Julian" <ad***@jdmils.c om> schrieb
I'm using the following VB.Net code to retreive the field names of a
table in an Access db:

Dim NewField As ADOX.Column
Dim tblField As ADOX.Column

For Each tblField In adocat.Tables(" tblData").Colum ns
The fields are returned in alphabetical order! I want to have the
fields returned in the order they were created. Can this be done?

-Julian


It is not available in ADOX. Use DAO for native Jet support. See the
Ordinalposition property of the Field object. The DAO docu also says that
two fields can have the same ordinal position. More information:
http://msdn.microsoft.com/archive/de.../D2/S5A2D1.asp
Armin

Mar 11 '06 #2
How do you use DAO in VB.Net?

--
|
+-- Julian
|
"Armin Zingler" <az*******@free net.de> wrote in message
news:e7******** ******@TK2MSFTN GP11.phx.gbl...
"Julian" <ad***@jdmils.c om> schrieb
I'm using the following VB.Net code to retreive the field names of a
table in an Access db:

Dim NewField As ADOX.Column
Dim tblField As ADOX.Column

For Each tblField In adocat.Tables(" tblData").Colum ns
The fields are returned in alphabetical order! I want to have the
fields returned in the order they were created. Can this be done?

-Julian


It is not available in ADOX. Use DAO for native Jet support. See the
Ordinalposition property of the Field object. The DAO docu also says that
two fields can have the same ordinal position. More information:
http://msdn.microsoft.com/archive/de.../D2/S5A2D1.asp
Armin

Mar 12 '06 #3
Armin Zingler wrote:
"Julian" <ad***@jdmils.c om> schrieb
I'm using the following VB.Net code to retreive the field names of a
table in an Access db:

Dim NewField As ADOX.Column
Dim tblField As ADOX.Column

For Each tblField In adocat.Tables(" tblData").Colum ns
The fields are returned in alphabetical order! I want to have the
fields returned in the order they were created. Can this be done?

-Julian



It is not available in ADOX. Use DAO for native Jet support. See the
Ordinalposition property of the Field object. The DAO docu also says
that two fields can have the same ordinal position. More information:
http://msdn.microsoft.com/archive/de.../D2/S5A2D1.asp

Armin


You can get it in ADO which is the .net way of doing things. There is a
function on the connection or command object called gettableschema that
will get you the info you want.

Chris
Mar 12 '06 #4
"Chris" <no@spam.com> schrieb
It is not available in ADOX. Use DAO for native Jet support. See
the Ordinalposition property of the Field object. The DAO docu
also says that two fields can have the same ordinal position. More
information:
http://msdn.microsoft.com/archive/de.../D2/S5A2D1.asp

Armin


You can get it in ADO which is the .net way of doing things. There
is a function on the connection or command object called
gettableschema that will get you the info you want.

I thought ADOX is even closer to DAO than ADO.Net. Therefore I did
not even think of doing it in ADO.Net. But your probably right.
Armin

Mar 12 '06 #5
"Julian" <ad***@jdmils.c om> schrieb
How do you use DAO in VB.Net?

Set a reference to "Microsoft Data Access Objects". But you should probably
better have a look at Chris' answer.

See also: System.Data.Ole Db.OleDbConnect ion.GetOleDbSch emaTable

and

http://msdn.microsoft.com/library/en...mns_rowset.asp
Column "ORDINAL_POSITI ON"

http://msdn.microsoft.com/library/en...t_overview.asp
especially
http://msdn.microsoft.com/library/en...ma_rowsets.asp

Armin

Mar 12 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
5273
by: AAVF | last post by:
Hi We have a problem with a query. An Access database links via ODBC to a UNIX server. To speed things, we use the ODBC to load the relevant tables to the local PC that runs Access so that all querying is done locally. One of the reports we run allows the user to list all invoices within a period. They are also allowed to select a customer code and a product set on
3
3717
by: CSDunn | last post by:
Hello, I have a situation with MS Access 2000 in which I need to display report data in spreadsheet orientation (much like a datasheet view for a form). If you think of the report in terms of what a spreadsheet might show, the column names will actually be dynamic, based on data from a SQL Server 2000 database. The row data will also come from the same database. So in this case, I will have a main report and a subreport. I've already tried...
2
4018
by: Cro | last post by:
Dear Access Developers, I am developing a form with 'default view' set to "continuous forms". I am suffering with a problem I can't yet see a solution too. Each record has many fields. Two fields I would like to add a little extra functionality to are a check box and a combo box. More explicitly, I would like the 'enabled' property of a combo box control to be dependent on the value of a check box (a 'yes/no' field) in the same...
3
35475
by: alex_peri | last post by:
Hello All, I am having problems with sorting a recordset by fields in Access. I have a table with three columns called ID, SNo and Time and would like to sort the records by Time. I would like to sort them in the actual database and not just Order them with SQL. I have included the code I wrote below. Please bear in mind that I am very new to Access and SQL. I used the Helpfile of Access for this code but i can't make it work for me....
3
3479
by: tesc | last post by:
I am so aggravated and need any help I can get. I am using Access 2000 and am trying to sort multiple fields in a select query. My query is set up as follows: FIELD 1 FIELD 2 FIELD 3 FIELD4 FIELD 5 FIELD 6 MSA03 MSA 02 % change ICU 03 ICU 02 % change calc. calc. This format continues and in some queries I have up to 13 percentages to sort. I need to sort each percentage to show over 20%...
6
17162
by: Brian | last post by:
Hello, Basically, I'm running a query on a form's activation, and I'd like to have the results of the query be placed into other fields on the same form automatically. Does anybody know how this can be done? I've tried setting the default value of the text fields on the form to be equal to ! using Access' expression
5
3015
by: Bec | last post by:
I'm in desperate need of your help.. I need to build an access database and have NO idea how to do this.. Not even where to start.. It IS for school, and am not asking anyone to do my homework for me.. I am merely asking for help, perhaps pointers as to where to begin.. I've never used access before.. I'm rather cluey when it comes to
3
1643
by: Danzak | last post by:
Can anyone out there help me with a problem I’m having? I have a database with 10117 records in it. Each record is numbered from 0001NHP to 10117NHP. Sometimes I have the database in alphabetical order of names and sometimes in number order. The problem is when I put it into number order. It runs in order until it gets to 0999NHP then it jumps to 10000NHP runs to 10009NHP then back down to 1000NHP then to 10010NHP which runs to 10019NHP the...
1
2807
by: Webstorm | last post by:
Hi, I hope someone can help me sort this out a bit, Im completely lost. Here is the page I am working on: http://www.knzbusinessbrokers.com/default.asp I have 3 search critera that I need to use when querying the database. Right now it is only looking for a match on one of those dropdowns and not all 3. can anyone help? Here is the code: <form BOTID="0" METHOD="POST" action="businessforsale_interface/Results/test3.asp">
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10542
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10309
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10289
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7600
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5496
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4274
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.