Checking for errors in spreadsheet to be imported to a table

kjharve

Board Regular
Joined
Jan 4, 2006
Messages
206
Hi,

I am setting up a database for the company I work for. The database will be fed information from various departments. Each of these departments will have to populate spreadsheets. Some will be done manually, others by existing computer systems.

Potentially there could be errors in the spreadsheets, there might be typographical errors, duplicate records or key violations etc. As far as I can see I have a few options:

1.) Use the TransferSpreadsheet function and let Access worry about errors but risk some data not being transferred.

2.) Write the data to a temporary table first and then check each record before writing it to the actual table.

3.) Write some code in Excel VBA which uses ADO to check for errors in the spreadsheet so that when it is imported I can be confident no errors exist.

What method is generally employed in this situation? And are there any pitfalls I need to be aware of?

Advice appreciated!

PS - Sorry for the "essay-style" question!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

MyBoo

Board Regular
Joined
Aug 9, 2006
Messages
217
Being that you can't know ahead of time what types of errors will be found, I would use essay entry #2 first. This would allow me to at least see what I'm up against. I would make a report of errors and report them to each dept head to see if there were some sort of action plan that could be implemented at that level (most probably not). Based on my findings, I may find it easier to write VBA against the temporary table.

I don't think essay entry #1 is a good solution... #2, then #3 is the way to go. IMHO
 

kjharve

Board Regular
Joined
Jan 4, 2006
Messages
206
You're right, #1 is definitely the least preferred. I would need to rely on the database user to correct errors and re-import any data that got left out - not likely to happen.

The only thing that puts me off writing to a temporary table is that my Excel VBA skills are far better than my knowledge of Access.
 

MyBoo

Board Regular
Joined
Aug 9, 2006
Messages
217
Well, then being that you're more comfortable with VBA in Excel, I'd go through door #3 then.

Although, I think you would get more out of VBA for Access... my opinion... and what you know in Excel VB, can quickly and easily be transported to Access VBA. Little differnces, but the concepts are exactly the same.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
Kev

Why not eliminate the errors in the spreadsheets by using things like Data>Validation...?
 

Forum statistics

Threads
1,136,346
Messages
5,675,228
Members
419,555
Latest member
Paddington

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