paste append data from excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

how can i create a macro or a procedure to automatically paste append 16
records from an exel sheet into my subform?
 
Look at the TransferSpreadsheet method.
' import from the spreadsheet
DoCmd.TransferSpreadsheet acImport, 8, "tbl_cie_raw_data",
"D:\availability.xls", False, "a1:g200"
tbl_cie_raw_data temp table ---- to store the raw data
D:\availability.xls ----- location of the file and filename
a1:g200 -- spreadsheet range to import this optional.

Be careful how you use this command, I suggest you import the spreadsheet
into a temp table as the data types when you import may not be the same as
your table in the subform or in the same order as the subform table. Then
run a query to append the relevant fields from your temp table to the
subform table. Then run a query to delete the records from your temp table
for future use.
 
i just thought of a simpler way - what if i put those 16 records into a new
unrelated table and import it from there?
 
Back
Top