Thread: Column Name
View Single Post
  #4  
Old May 13th, 2010, 06:30 PM posted to microsoft.public.access.gettingstarted
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default Column Name

rst.Columns.Count

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"Bre-x" wrote in message
...
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