Results 1 to 4 of 4

Thread: tbales, sorting by value

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 1999
    Location
    New Jersey
    Posts
    334

    Post

    hi! I wanted to know if there's any VB control which you can use as a table. I want to sort the value of different variables from biggerst to smallest. Does anyone know an easy way to do this? Thanks in advance,
    Alexander McAndrew

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    If you're talking about to show the data from the table in your VB application then you can use an SQL statement to specify the order.

    Select * From MyTable Order By Column1 Desc


    Regards,

    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819



    [This message has been edited by Serge (edited 11-16-1999).]

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 1999
    Location
    New Jersey
    Posts
    334

    Post

    thanks, but how can I create a table and add things to it during run-time? Should I use an excel chart? Or is their a VB control I can use? Thanks in advance,
    Alexander McAndrew

  4. #4
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    You can use any controls that suites your needs. For example, lets say you have a table called Customer. So the table Customer structure will look something like this:

    Fields
    CustID - Autonumber
    CustFName - Text
    CustLName - Text
    Address - Text
    City - Text
    State - State
    Zip - Text
    Phone - Text

    So, the best way is to create a control array of TextBoxes. So, lets say we have a contols array named txtInfo (7 textboxes)
    And now we want to save the info you typed in the textboxes (the CustID will be created automatically). Also, in this sample I assume that the database is an Access database.

    Code:
        Dim db As Database
        Dim rs As Recordset
        Dim i As Integer
        
        Set db = Workspaces(0).OpenDatabase("D:\Microsoft Visual Studio\VB98\Nwind.mdb")
        Set rs = db.OpenRecordset("Customer", dbOpenTable)
        
        rs.AddNew
        For i = 0 To txtInfo.UBound
            rs(i + 1) = txtInfo(i)
        Next
        rs.Update

    Regards,

    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819



    [This message has been edited by Serge (edited 11-16-1999).]

Posting Permissions

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



Click Here to Expand Forum to Full Width