If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > moving column i9n table in alphabetical order

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-09-07, 08:59
sal21 sal21 is offline
Registered User
 
Join Date: Oct 2004
Posts: 61
moving column i9n table in alphabetical order

In VBA for Excel macro...please

is possible to ordering in alphabetical mode the column in table with a VBA code...?

path of mdb=c:\db2.mdb
table name=test

have in table this column named
aaa
cccc
bbb

i want in table after code reordering the column in
aaa
bbb
ccc
Reply With Quote
  #2 (permalink)  
Old 05-09-07, 11:00
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
select aaa, ccc, bbb from yourTable ?

Also, you say this is a vba macro for excel, then provide two lines of code that don't mean anything but implicate you're working with access. Can you be a little more forthcoming with details?
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
  #3 (permalink)  
Old 05-09-07, 11:24
sal21 sal21 is offline
Registered User
 
Join Date: Oct 2004
Posts: 61
Quote:
Originally Posted by Teddy
select aaa, ccc, bbb from yourTable ?

Also, you say this is a vba macro for excel, then provide two lines of code that don't mean anything but implicate you're working with access. Can you be a little more forthcoming with details?
hI Teddy, peraphS solved with this code, but i want to exclude from the column ordering the field named "DATA_AGG" (attached example of mdb):
Code:
Option Explicit
Sub ORDER_FILEDS()

    Dim DATABASE As DAO.DATABASE
    Dim TABELLA As DAO.TableDef
    Dim CAMPO_TEMP As DAO.Field
    Dim POSIZIONE() As Integer
    Dim CAMPO_NOME() As String
    Dim INT_TEMP As Integer

    Set DATABASE = OpenDatabase("C:\OPERATORI.mdb")
    Set TABELLA = DATABASE.TableDefs("TEST")

    With TABELLA

        ReDim POSIZIONE(0 To .Fields.Count - 1) As Integer
        ReDim CAMPO_NOME(0 To .Fields.Count - 1) As String

        For INT_TEMP = 0 To .Fields.Count - 1
            POSIZIONE(INT_TEMP) = .Fields(INT_TEMP).OrdinalPosition
            CAMPO_NOME(INT_TEMP) = .Fields(INT_TEMP).Name
        Next INT_TEMP

        For Each CAMPO_TEMP In .Fields
            CAMPO_TEMP.OrdinalPosition = 1
        Next CAMPO_TEMP

    End With

    DATABASE.Close

End Sub

Last edited by sal21; 01-11-09 at 06:31.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On