ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   rs.addnew - named range vs. individual cell (https://www.excelbanter.com/excel-programming/420910-rs-addnew-named-range-vs-individual-cell.html)

Jessica

rs.addnew - named range vs. individual cell
 
Hi Everyone,

I know I can write the codes as follows to transfer data from Excel to
Access...

..AddNew
!FirstName = strFirst
!LastName = strLast
.Update

but is there anyway to specify and entire named range and have that append
into the access table without specifying each individual field? I've made my
excel record include all fields the same as the access record.

~Jessica

roger

rs.addnew - named range vs. individual cell
 
"Jessica" wrote in message
...
Hi Everyone,

I know I can write the codes as follows to transfer data from Excel to
Access...

.AddNew
!FirstName = strFirst
!LastName = strLast
.Update

but is there anyway to specify and entire named range and have that append
into the access table without specifying each individual field? I've made
my
excel record include all fields the same as the access record.

~Jessica


Hi Jessica,

You can probably do something like this...

rs.AddNew
For i = 1 To rs.Fields.Count
rs(i - 1) = Range("whatever").Cells(1, i)
Next
rs.Update

Roger




All times are GMT +1. The time now is 12:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com