Transferring Excel Columns to Access Fields

mahmud1180

New Member
Joined
Oct 26, 2015
Messages
17
Hi there!! I want to run a VBA code that makes a column in the excel file and then transfer it to Access with a certain Field Name. Then this excel Column is replaced by another set of Values and I want to transfer it to Access with another Field Name.I have a recurring procedure so, I can not use the AccessImport Method. I can add values cell by cell but I want to avoid that as it is gonna take more time. Can anyone help? Thanks a lot!!
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
I think the problem lies with the "Inset Into ..... Select From " statement where it picks up the data from Excel worksheet not from the Access table. Can you please give me a correct syntax for that? Thanks a lot!
 
Upvote 0
You're writing a query of Excel data which is fine, but without headers how will Access know which field names to assign?
 
Upvote 0
That's right, but is your Access database updating those records to existing fields or creating new fields with names like 1000000 etc.?
 
Upvote 0
It's updating the excel records to a existing field. It's not creating any field with the name of 1000000 (at least that's what I think)

Can you give me an example of query of excel data? I tried "Insert into Values()" sytax. This works with a single record but not with multiple records. or Can I insert into a table from a recordset? I think I can. But that wasn't working either with multiple records :/
 
Upvote 0
I tested the code here:

https://support.microsoft.com/en-us/kb/145826

which successfully appended an Excel spreadsheet to an Access database. The fields were set up identically in each, and I named the Excel range rather than leaving it as an address. I only have Access 2003 which might not be able to handle the later ADO methods, and saved the spreadsheet in Excel 2003 even though 2010 would probably be ok too.
 
Upvote 0
I tried the code but I still get the same error :( "The INSERT into statement contains the following unknown field name: '10000000'. Make sure you have typed the name correctly" . 100000000 is actually the first value in the data range
 
Upvote 0
Wait I'll try to find a way to turn off the headers import

HDR = No?

(in the first code you tried)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,834
Messages
6,162,268
Members
451,758
Latest member
lmcquade91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top