+ Reply to Thread
Results 1 to 3 of 3

Loop through a User-Defined Type?

  1. #1
    uf_gator
    Guest

    Loop through a User-Defined Type?

    Does anyone know of a way to loop through a User-Defined type?

    Here is what I am looking to do. Say I have this UDT...

    Public Type BigType
    a1 as String
    a2 as String
    a3 as String
    ....
    a50 as String
    End Type

    I'm populating a variable of this type through a database query where
    each item in the type aligns with a row in the query, so it is ideally
    arranged for a simple loop. Granted, I could arrange this as an array,
    but it is important to this particular application to have the UDT.

    I've looked into the VBA Extensibility, but it seems a little overkill
    to create a new sub on the fly to populate the UDF.

    My apologies if I am repeating a recent post, but I have not been able
    to find anything recent.

    Thanks


  2. #2
    Toppers
    Guest

    RE: Loop through a User-Defined Type?

    Could you define UDT as

    Public Type BigType
    a(50) as string
    End type

    So if we have Var(100) as BigType

    For j= 1 to 100
    For i=1 to 50
    var(j).a(i)= .....
    next i
    next j


    "uf_gator" wrote:

    > Does anyone know of a way to loop through a User-Defined type?
    >
    > Here is what I am looking to do. Say I have this UDT...
    >
    > Public Type BigType
    > a1 as String
    > a2 as String
    > a3 as String
    > ....
    > a50 as String
    > End Type
    >
    > I'm populating a variable of this type through a database query where
    > each item in the type aligns with a row in the query, so it is ideally
    > arranged for a simple loop. Granted, I could arrange this as an array,
    > but it is important to this particular application to have the UDT.
    >
    > I've looked into the VBA Extensibility, but it seems a little overkill
    > to create a new sub on the fly to populate the UDF.
    >
    > My apologies if I am repeating a recent post, but I have not been able
    > to find anything recent.
    >
    > Thanks
    >
    >


  3. #3
    uf_gator
    Guest

    Re: Loop through a User-Defined Type?

    Unfortunately, no. A big part of defining the UDT in our application
    is to make coding easier by leveraging the intellisense...converting
    the UDT to two-dimensional array would make it difficult to understand
    what item in the array refers to a specific property.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1