Creating array to recordset

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • yankee1423@yahoo.com

    #1

    Creating array to recordset

    Hello all,

    I have 3 tables with 1 field in each. The third table has half a
    million rows in it so I can do this with excel. What I want to do is
    create an array that I can export to Excel. The data is as follows:

    Table 1: C1, C2
    Table 2: M1, M2, M3
    Table 3: L1, L2, L3, L4, L5, L6

    The problem is that I want each value for Table 1 on the side and each
    value for Table 2 on the top as headings with Table 3 filling in the
    data. There is a relationship that needs to be held. For this data,
    the results I want would look like:

    M1 M2 M3
    C1 L1 L2 L3
    C2 L4 L5 L6


    I can't seem to figure this out in Access vba. Any pointers or help is
    appreciated.

  • yankee1423@yahoo.com

    #2
    Re: Creating array to recordset

    Ok, I was able to create the array I think but now I need to do the
    following. The array is 591 rows by 971 columns and null values are
    not possible.

    I need to find the the highest value for each column and if possible
    find out what row that falls on. In the end I'd like to have a table
    that is 971 records where each record is the highest number found in
    that column (1 - 971) kind of like the following:

    Record 1 .35 Row 482
    Record 2 .56 Row 2
    Record 3 .0001 Row 99
    *
    *
    Record 971 .056 Row 311


    Here is what I have so far for getting the array.-------------

    Sub check()
    Dim Con As Recordset
    Dim lodf As Recordset
    Dim mon As Recordset
    Dim mystuff(591, 971) As Double
    Dim c As Integer
    Dim m As Integer
    Dim I As Integer


    Set db = CurrentDb
    Set lodf = db.OpenRecordse t("Ltable")
    Set Con = db.OpenRecordse t("Ctable")
    Set mon = db.OpenRecordse t("Mtable")

    lodf.MoveFirst
    For c = 1 To 591
    For m = 1 To 971
    mystuff(c, m) = lodf![LField]
    lodf.MoveNext
    Next m
    Next c


    End Sub

    Comment

    Working...