Thank you, Now how could I find out how many columns are there?
If rst!column3 does not exits the code stop executing: "Item not found in
this collection"
"Arvin Meyer [MVP]" wrote in message
...
In your example, it is the first column and second column, so:
objSht.Cells(iRow, 1).Value = rst!column1
objSht.Cells(iRow, 1).Value = rst!column2
should be:
objSht.Cells(iRow, 1).Value = rst!column1
objSht.Cells(iRow, 2).Value = rst!column2
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access