culbysl wrote:
I can open the excel file and begins to read but when I come across an empty file I get a dbNull error.
When you come acrossed an empty Excel FILE?? Or Cell?? If it's an empty file, you can just capture the error in a Try/Catch block and move on:
' Setup connection stuff...
' Setup your loop, enumerating your files...
Try
' Open the connection
' Execute the SELECT statement
Catch ex As Exception
' Handle the emtpy file problem here...
Finally
If connection is not closed then
Close connection
End Try
' Loop around to process the next file...
culbysl wrote:
Wrong number of arguments used with function in query expression 'IsNull('Column Name', '')'.
You can't use Excel functions in the SELECT statement because Excel is not doing the processing here. You should either stick with the * or specify the columns you're actually goint to use. Now, if your code is bombing try to use a DBNull value from a cell, then your code has to check to see if that value is DBNull before trying to use it. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome