Import Excel data range into Access Database using a SQL Query.

mcAvero

New Member
Joined
Jun 24, 2020
Messages
6
Office Version
  1. 2010
Platform
  1. Windows
Hi there I have used the the following SQL Query in Access to the following range (A5 to T1000) from Excel, to be placed into a Table in Access with Headers.

SELECT * INTO [Ref_Tracker_File]
FROM [Excel 8.0;HDR=Yes;database=\\mark\access\Program\Tracker\Orders\Tracker 2020.xlsm].[Tracker$A5:T1000];

I used this code a few year ago, now only get the following error:
"The connection for viewing your linked Microsoft Excel file was lost."

Thoughts or other SQL alternatives ?
 

Attachments

  • 1596215338415.png
    1596215338415.png
    12.5 KB · Views: 0

Some videos you may like

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,492
Office Version
  1. 365
Platform
  1. Windows
You can still do it using Linked tables.
The key is to use named ranges in Excel. Just start the named range on row 4. Then when you are linking the data in Access, you can select the named range.
 

mcAvero

New Member
Joined
Jun 24, 2020
Messages
6
Office Version
  1. 2010
Platform
  1. Windows

ADVERTISEMENT

would agree, though I have 10 excel files from different teammates, which the code above above allowed me to bring in a selected data range.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,492
Office Version
  1. 365
Platform
  1. Windows
Well, you asked for thoughts, and that was mine.
If it were me, I would probably look to do one of the following:
1. See if the entire process can be done in Access, and get rid of the Excel part
- or -
2. Run an Excel macro that first deletes the first 4 rows of data, so the header is one row 1, before importing.
 

mcAvero

New Member
Joined
Jun 24, 2020
Messages
6
Office Version
  1. 2010
Platform
  1. Windows
I thank you for the feedback, i will try option 2.
 

Watch MrExcel Video

Forum statistics

Threads
1,126,942
Messages
5,621,737
Members
415,853
Latest member
Newlife72

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
Top