Re: how do I write the contents of an array to an access table

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Old Guy,

Are you certain you need to use an array? Very often it's possible to
express the manipulation in SQL and implement it as a query. Ideally you
wouldn't even store the manipulated data in a table, but generated it on
the fly.

If the array is essential, to write the data to the other table you do
something like this. Ar() is your array:

Dim j As Long
Dim f As Long
Dim rsR as DAO.Recordset
Set rsR = CurrentDB.OpenRecordset("OtherTable")

With rsR
For j = 0 to UBound(Ar,0) 'loop through records
.AddNew
For f = 0 to UBound(Ar,1) 'loop through fields
rsR.Fields(f).Value = Ar(j,f)
Next r
.Update
Next j

.Close
End With

On Fri, 8 Jun 2007 13:20:01 -0700, The Old Guy
<TheOldGuy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

I would like to populate an array with data from a table, manipulate some or
all of the data, then write the array contents to a different table. The
first two steps are relatively straight forward but the last step has me
baffled. Any suggestions?

--
John Nurick [Microsoft Access MVP]

Please respond in the newsgroup and not by email.
.



Relevant Pages

  • Re: Google und Bing entfernen "climategate"
    ... da sieht es etwas anders aus, was die Manipulation betrifft" .. ... manipuliert worden, bzw. mit Hilfe von CC seien Manipulationen ... angebliche Ersetzung von Werten in einem Array durch Zufallswerte. ... braucht das nicht durch Interpolation ...
    (de.soc.umwelt)
  • Re: is it bug? for
    ... kind of manipulation, Array() is better, anyhow. ... Axel ... Psssst! ...
    (comp.lang.ruby)
  • Re: GetRows
    ... Retrieves multiple records of a Recordset object into an array. ... My experience is that VBA Array manipulation is faster ...
    (comp.databases.ms-access)
  • Re: Lisp Challenge
    ... some solutions to Ruby Quiz #43 ... I'm interested to see how people tackle the string ... manipulation as its something I've been wrestling myself in various ... For example with a 9x9 array, ...
    (comp.lang.lisp)
  • Re: Detecting a running process.
    ... Private Declare Function EnumProcessModules Lib "psapi.dll" _ ... (ByVal dwProcessID As Long, _ ... Dim nProcesses As Long ... 'fill an array of longs with the ...
    (microsoft.public.vb.winapi)