Re: Help copying an array into an ADO recordset

From: Val Mazur (group51a_at_hotmail.com)
Date: 05/26/04


Date: Tue, 25 May 2004 21:07:28 -0400

Hi,

You could create fabricated recordset using next sort of code

Set loMyRecordset = New ADODB.Recordset

With loMyRecordset.Fields

   loMyRecordset.CursorLocation = adUseClient

   .Append "MyFieldName1", adInteger
   .Append "MyFieldName2", adVarChar, 10, adFldIsNullable
....

   loMyRecordset.Open

End With

Now you could populate this recordset as any regular ADO recordset using
AddNew method

-- 
Val Mazur
Microsoft MVP
"rotor" <anonymous@discussions.microsoft.com> wrote in message 
news:2B6C8FE9-5535-4BD6-A216-527C3FBC4DA1@microsoft.com...
> Hello, I'm using VBA in Win 2k with Office XP.
>
> I have an array of data that has been crunched that I would like to copy 
> into an ADO recordset. I'm not sure where to begin. For instance, can you 
> just open an empty recordset and then write data into it? How?
>
> If someone has a function to do this could you please post example VBA 
> code? I'm presuming that this process is the same regardless of App (i.e. 
> whether working in Excel or Access?).
>
> Thanks in advance for the assistance. 


Relevant Pages

  • RE: open arguments.
    ... Do you use Macros or the VBA (Visual Basic ... Each Access Form may be bound to a Recordset and each Recordset ... do this then you must explicitly reference every object you use or Access ... Dim strFilter As String ...
    (microsoft.public.access.modulesdaovba)
  • Re: Data Changing Issue
    ... In the query, on the field line, I added the above expression. ... *if* you are in VBA. ... the data of your table from a recordset. ... I am running some queries using a form I created and for some ...
    (microsoft.public.access.queries)
  • Re: MS Access 2003 CrossTab Query Question using VBA--Item not fou
    ... VBA code runs & hits the break point the code will stop and the VBA ... Your code only reads the first row of the recordset. ... before running a crosstab ones does not know how many columns will appear and what their name will be..that is the natureof a crosstab. ... going to appear based on parameter criteria fed to an underlying query that a crosstab query is created from. ...
    (microsoft.public.access.queries)
  • Re: EDI export
    ... To put each column in one line you'll have to use VBA & a recordset. ... > export a text file from a query or table. ... > It has to all be in a single column. ...
    (microsoft.public.access.queries)
  • Re: Compile ErrorInteracting with Access
    ... I'm relatively new to the VBA areana. ... > | Dim Cnct As String, ... > | Dim Recordset As ADODB.Recordset ... > | Set Connection = New ADODB.Connection ...
    (microsoft.public.excel.programming)