UDT Array in an array

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rowan

    #1

    UDT Array in an array

    Greetings:

    I need some guidance. I have been using UDT's and arrays to hold
    information so I can easily display data and save it. I am in the
    process of building a new form and ran across a problem I can't figure
    out how to solve.

    I have a UDT as follows:

    Public Type udtBL
    scac As String * 4
    BL As String * 12
    GrossWt As Double
    GW_UOM As String * 1
    PcCt As Double
    PC_UOM As String * 4
    po_id() As Long
    po() As String * 20
    Status() As String * 2
    ContainerNumber () As String * 11
    SealNumber() As String * 20
    TypeID() As Integer
    ContGW() As Double
    ContGW_UOM() As String * 1
    contPC() As Double
    ContPC_UOM() As String * 4
    ContVol() As Double
    ContVol_UOM() As String * 4
    End Type

    In my form I do the following

    Option Explicit
    Dim BL() As udtBL

    Private Sub Form_Load()
    Redim BL(1 to 100)
    '-----Then I load it using the syntax BL(i).Container Number(x) =
    "Container1 "
    End Sub


    This is all fine and dandy, but in this particular form, the Container
    has multiple PO numbers I want to load as well. I have no idea how to
    do this.

    So i have my BL(1).BL = "BL1"
    my BL(1).Container (1) = "Container1 "
    But then Container1 has two Purchase Orders that go with it...PO1 and
    PO2.

    How can I store the Purchase Orders for that container?

    I would think it should be BL(1).Container (1).PO(1)

    Can I do this? If so, what is the syntax? Is there a better, more
    efficient way to deal with this? I am very comfortable with arrays.

    I would really appreciate any help.

    --rowan
  • The Grim Reaper

    #2
    Re: UDT Array in an array

    Rowan,

    Read up on Classes. It's fairly simple to create a class that mirrors the
    properties of a UDT, with the added bonus of property control, classes
    within classes, etc.
    When I first started "upgrading" my old programs to use classes, I was
    daunted by it, but now I can't write even a simple tool without a class in
    it!! Plus, if you move up to .NET, you'll need a good understanding of
    class objects and all the associated gubbins.
    Hope that gets you on your way - I know how it feels to not have anyone
    answer your query for days...
    _______________ _______________ ____
    The Grim Reaper

    "Rowan" <phantomtoe@yah oo.com> wrote in message
    news:4bbf8d70.0 406101641.7faaa e7b@posting.goo gle.com...[color=blue]
    > Greetings:
    >
    > I need some guidance. I have been using UDT's and arrays to hold
    > information so I can easily display data and save it. I am in the
    > process of building a new form and ran across a problem I can't figure
    > out how to solve.
    >
    > I have a UDT as follows:
    >
    > Public Type udtBL
    > scac As String * 4
    > BL As String * 12
    > GrossWt As Double
    > GW_UOM As String * 1
    > PcCt As Double
    > PC_UOM As String * 4
    > po_id() As Long
    > po() As String * 20
    > Status() As String * 2
    > ContainerNumber () As String * 11
    > SealNumber() As String * 20
    > TypeID() As Integer
    > ContGW() As Double
    > ContGW_UOM() As String * 1
    > contPC() As Double
    > ContPC_UOM() As String * 4
    > ContVol() As Double
    > ContVol_UOM() As String * 4
    > End Type
    >
    > In my form I do the following
    >
    > Option Explicit
    > Dim BL() As udtBL
    >
    > Private Sub Form_Load()
    > Redim BL(1 to 100)
    > '-----Then I load it using the syntax BL(i).Container Number(x) =
    > "Container1 "
    > End Sub
    >
    >
    > This is all fine and dandy, but in this particular form, the Container
    > has multiple PO numbers I want to load as well. I have no idea how to
    > do this.
    >
    > So i have my BL(1).BL = "BL1"
    > my BL(1).Container (1) = "Container1 "
    > But then Container1 has two Purchase Orders that go with it...PO1 and
    > PO2.
    >
    > How can I store the Purchase Orders for that container?
    >
    > I would think it should be BL(1).Container (1).PO(1)
    >
    > Can I do this? If so, what is the syntax? Is there a better, more
    > efficient way to deal with this? I am very comfortable with arrays.
    >
    > I would really appreciate any help.
    >
    > --rowan[/color]


    Comment

    Working...