Access 97 query Numeric Field Overflow. qry links to excel sheet

hey yer barred

Board Regular
Joined
Jun 19, 2007
Messages
232
Hi All

I have a query set up in a Access 1997 database which runs fine under the query tab and run manually. The query is a append query which takes data from a Excel sheet and puts it into a table in the database.

When I run it through coding, I keep getting a run-time erro 3349 'Numeric field OverFlow'. Does anyone know how to stop this or fix it please?

I know I could use the transfersheet code but there is 7 tabs on this workbook, and the code doesnt let me select a tab. The workbook is on a shared drive as is put there by someone else each day, so its impossible for me to save it on the sheet I want....plus I need 2 sheets out of it!

Thanks for your help
HYB
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
You can specify a range on a particular worksheet as an argument to the transferspreadsheet method, if that helps?
 
Upvote 0
Rory's suggestion is exactly what you want to do. I do this myself quite often, and can attest that it works quite well.

Name each of your ranges that you want to import (Insert -> Name -> Define in Excel). Then, used that named Range when importing (you can specify named range instead of Sheet). That way, no matter what sheet the workbook is saved on, the import will work.

The only "caveat" is if the size of your range is not static, you might need some Excel VBA to automatically resize your range so that you get all your data.
 
Upvote 0
It'd just be something like:
Code:
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, _
    "Employees","C:\blah\myfile.xls", True, "Sheet1!A1:G12"
 
Upvote 0
Thank you both for your help, its much appreciated!

For future ref incase anyone else gets this error in the future, it is caused by blank cells in the Excel sheet. From what I can gather if there is a entire blank column (like my sheet has) or the first few cells are blank it causes this numeric overflow. No surprise that MS have not put a fix or patch in for this!
 
Upvote 0
In that case you'll get the overflow if you have a key defined as Integer, instead of Long. Integer maxes out at 32K, halfway down the worksheet.
The defined range is a good way to avoid importing blank rows and columns.

Denis
 
Upvote 0

Forum statistics

Threads
1,221,709
Messages
6,161,442
Members
451,705
Latest member
Priti_190

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