The RunSQL method would require turning everything into a string, yes, because SQL statements are always passed to Jet as strings. But that doesn't mean that they would be stored in the database as Text values, nor would you have to change them in your array. You need to understand that the string you build for RunSQL is a VBA string, but once it gets passed to Jet, it will be reinterpreted. For example, a SQL statement that inserts an integer value would be built as a string like this:
INSERT INTO MyTable (OrderID) VALUES (12345)
Although the "12345" is part of a VBA string, within the SQL statement it represents a numeric constant value. On the other hand, a SQL statement that inserts a text value would be built in VBA like this:
INSERT INTO MyTable (OrderID) VALUES ('12345')
Do you see the difference?
Since you're having some confusion about this, let me explain how you'd need to build the VALUES entry for each kind of field.
For a String value, you need to enclose it in apostrophes:
"'" & arrayvalue(i) & "'"
For a numeric value, you don't need any delimiters:
CStr(arrayvalue(i))
For a date value, you need to enclose it in "#" characters:
"#" & arrayvalue(i) & "#"
The parenthesized item following the table name is a list of fields you are providing data for, separated by commas. The parenthesized item following VALUES is a list of values, corresponding one-for-one with the list of field names.
If you still don't understand (it's kind of a tough concept), give me a list of field names you're inserting, their data types, and the name and dimensions of the array, and I'll try to write the code for you. It might be easier to understand after that.
It's surprising that you don't know the DoCmd object. You must not have been doing Access coding for long. DoCmd is an Access-provided object that provides very many functions. You should look it up in the Help file, for a start, then examine the Northwind database to see how it's used.
As a general rule, you're right, recordset processing is slower than SQL statements. But that's much less true here, where you're only inserting one record per statement. It's much truer when you're using an Update query, for example, to apply the same updating criteria to all records in a table. Doing that with a DAO recordset is much slower (though the difference will be invisible to the user for small numbers of records).
However, if your array is very large, so that you are adding very many records to the database from it, using either a recordset or SQL will be slow (since you're only inserting one record per SQL statement). You can improve that a little by using a "transaction". A transaction makes a set of updates an all-or-nothing proposition; if a failure occurs while the transaction is active, all updates to that point are "rolled back"--removed from the database. Transactions are more efficient because Jet doesn't have to finalize any updates until after all of them have been performed.
To use a transaction, simply execute this statement before you begin updating:
DBEngine(0).BeginTrans
After you're finished updating, execute this statement:
DBEngine(0).CommitTrans
If a runtime error occurs or something else makes you want to roll back all your updates, you execute this statement instead of the CommitTrans one:
DBEngine(0).Rollback
Rick Sprague