Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check Excel File For Data

Status
Not open for further replies.

rookery

Programmer
Apr 4, 2002
384
0
0
GB
Does anyone know if it's possible to check an Excel file before import i.e using TransferSpreadSheet method, to assess if it contains any data?

I dont want my users importing blank Excel spreadsheets into the database.
 
You have to open Excel and check each sheet or at least one if it contains data - if it does you proceed with the TransferSpreadsheet, otherwise you stop.
 
Thanks but how do you check to see if the sheet contains data? Check each row individually? This sounds very long-winded.
 
I do not think there is another way. But you can limit the range so you do not check thousands if you know the data will be say in the first 500 columns and rows. It does not take long to run. I have done it, and it runs rather quickly.
 
I thought this would be the case. It seems a rather crude method. I think what I might end up doing is importing the file into a table and then checking how many records are in the table using:

CurrentDb.Tabledefs("tblName").RecordCount

Thanks for your input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top