How can I add field names to an array, when I do not know the size of the array? In my two functions below, I am able to populate the table no problem, but when I try to create the array, it will only print the 1st record from the table. What must I do in order to create the array with all values?
Function PopulateTable()
Set rs1 = db.OpenRecordset("MasterList")
For Each fld In rs1.Fields
StrSQL = "INSERT INTO HoldTable (FieldList) VALUES ('" & fld.Name & "' );"
DoCmd.SetWarnings False
DoCmd.RunSQL StrSQL
Next
'Create array of all fld.Name Values
PopulateArray
End Function
Function PopulateArray()
Dim rstData As DAO.Recordset
Dim v As Variant
Dim cn As Variant
Set rstData = CurrentDb.OpenRecordset("select fieldlist from HoldTable")
v = rstData.GetRows(rstData.RecordCount)
For Each cn In v
Debug.Print CStr(cn)
Next
End Function