Copy and Clean Array Data into a Microsoft Access Table
Question details
Copy cleaned array values into corresponding fields in an Access table, or use a query where appropriate.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A user edits values in an array and needs to write the results to a destination table.
- Observed behavior
- Access does not provide a PutRow method for writing an array directly to a table; values must be assigned to fields or processed with a query.
Identify the source and destination fields, their data types, and any required destination fields. The examples use text fields named FirstName and LastName in tables named SourceTable and DestinationTable; replace them with your actual names.
Write cleaned array values with a DAO Recordset
Use this approach when your cleaning logic already works on an array or requires record-by-record processing.
Access has no PutRow method for this task. Open the destination Recordset once, then use AddNew, assign each array element to its destination field, and call Update for each source record.
In Access, press Alt+F11, then select Insert > Module in the VBA editor.
Paste this example into the module and replace the table and field names as needed: Public Sub CopyCleanedRows() Dim db As DAO.Database Dim src As DAO.Recordset Dim dst As DAO.Recordset Dim values As Variant Set db = CurrentDb Set src = db.OpenRecordset("SourceTable", dbOpenSnapshot) Set dst = db.OpenRecordset("DestinationTable", dbOpenDynaset) Do While Not src.EOF values = Array(Trim(Nz(src!FirstName, "")), Trim(Nz(src!LastName, ""))) dst.AddNew dst!FirstName = values(0) dst!LastName = values(1) dst.Update src.MoveNext Loop src.Close dst.Close Set src = Nothing Set dst = Nothing Set db = Nothing End Sub
Place the cursor inside CopyCleanedRows and press F5. Open DestinationTable in Access and verify that the new records and cleaned values are correct.

Append cleaned records with an Access query
Use an append query when the cleaning can be expressed in Access SQL, especially for larger datasets.
Work with spreadsheet data in WPS Office
WPS Office is a free, lightweight alternative for working with office documents and spreadsheets in a familiar interface. Its format compatibility can make migrating spreadsheet work easier, though it does not replace Microsoft Access or run Access queries and VBA procedures.

Frequently Asked Questions
Can Access write an entire array to a table with PutRow?
No. For a DAO Recordset, call AddNew, assign each array element to its matching field, and call Update for each new record.
Is an append query faster than looping through an array?
An append query is usually faster and more scalable for large datasets when the cleaning can be expressed in SQL. Create one through Create > Query Design and switch to SQL View.
How do I update existing records instead of adding new ones?
Use an update query with criteria that identify the records to change. An append query or Recordset AddNew adds new records instead.
What happens if a source value is Null?
In the examples, Nz(value, '') replaces Null with an empty string before Trim removes surrounding spaces. Adjust that rule if the destination should retain Null values.




