Results 1 to 4 of 4

Thread: [RESOLVED] Variable Length Array?

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2005
    Location
    Chicago
    Posts
    136

    Resolved [RESOLVED] Variable Length Array?

    I want to use an array, but I don't know what the size will be until I read the number of fields from a DB. All of the fields have the same name with a number appended to them (lr_transaction1, lr_transaction2...) but I'd like to maintain the flexibility to add new fields without having to code and recompile. Any suggestions?



    Code:
    Dim txtTrans() As String
    Dim z As Integer
    Dim strField As String
    
    z = 1
    
    For z = 1 To gsNumTrans
        strField = "lr_transaction" & z
        If IsNull(rsScript.Fields(strField)) Then
            txtTrans(z) = ""
        Else
            txtTrans(z) = rsScript.Fields(strField)
        End If
    Next

    The gsNumTrans variable holds the number of "lr_transaction" fields and is read from an INI file.

    And yes I know I'm using antique DAO technology, but it works and isn't worth the hassle to convert it at this point.
    Last edited by bat711; Dec 20th, 2007 at 03:48 PM.
    CodeBank: Launch IE

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