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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count the number of fields in a table? 2

Status
Not open for further replies.

Lost500

IS-IT--Management
Mar 10, 2009
110
US
I need a way to return a number value for the number of fields i have in any given table. I have an access database with linked tables to an sql server. thanks for the help!
 
Thanks dhookom, the only references i have selected are: microsoft access 12.0 object library, OLE Autoation, Microsoft Office 12.0 access database engine Object library, Microsoft excel 12.0 Object library, and vba. are any of those counted as a DAO reference? and also i tried the immediate window and it still tells me 'item not found in this collection' thanks for the help
 
OK, you have the reference set but the 'Item not found in this collection.' error means that the table name you've specified isn't in the tables collection (i.e. it isn't a table in your DB). Make sure you've got the name right and in the format specified by Duane, PHV and AceMan.

Hope this helps

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Ok guys first thanks dhookom this was a great effort and you def. went the extra mile thanks a million for the help. the code was fine from the get go I ended up using a pass through query I've found that with linked tables it's difficult to just directly call the linked table and make calculations off of it. thaks again!!!
 



You intend to export a query to Excel.

Is the reason that you are counting fields because the number of fields in a table may exceed 256?

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top