Recordset problem
  Home FAQ Contact Sign in
microsoft.public.access.modulesdaovba only
 
Advanced search
POPULAR GROUPS

more...

microsoft ... modulesdaovba Profile…
 Up
Recordset problem         


Author: Luis
Date: May 20, 2008 04:04

Hello.

I have a form with several fields and i'm using recordset clone property to
insert into an two dimension array variable( array_var(x,x) the name of the
field and the value of the field.

What i'm trying to do is to add a record on a table (Table1) with the values
stored on the array. All the information stored on the array is related only
to one record on the target table.

Can anyone give me a hint on looping through the array and store the info on
thos target table?

Thanks.

Luis
2 Comments
Re: Recordset problem         


Author: Stefan Hoffmann
Date: May 20, 2008 04:13

hi Luis,

Luis wrote:
> What i'm trying to do is to add a record on a table (Table1) with the values
> stored on the array. All the information stored on the array is related only
> to one record on the target table.
You normally don't need an array, try this:

Dim strSQL As String

strSQL = "INSERT INTO [yourTable] (fieldList) " & _
"VALUES (" & _
Me![field1] & ", " & _
Me![field2] & ", " & _
Me![fieldX] & ", " & _
")"

CurrentDb.Execute strSQL, dbFailOnError

When field is a String then you need

"'" & Replace(Me![fieldS], "'", "''") & "', " & _

mfG
--> stefan <--
no comments
Re: Recordset problem         


Author: Luis
Date: May 20, 2008 05:43

The problem of that solution is that the form has about 50 fields.

There's going to be a huge INSERT statement.

"Stefan Hoffmann" wrote:
Show full article (0.86Kb)
no comments