Re: how do I write the contents of an array to an access table
- From: John Nurick <j.mapSoN.nurick@xxxxxxxxxxxxxx>
- Date: Sat, 09 Jun 2007 07:08:21 +0100
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.
.
- Prev by Date: Re: 5 copy pasting
- Next by Date: Re: Get return PK value from SQL
- Previous by thread: Re: how do I write the contents of an array to an access table
- Next by thread: Re: Get return PK value from SQL
- Index(es):
Relevant Pages
|