Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default SQL with no headers

How do you use a WHERE statement if a table has no
headers?

i.e., say there is a table called "EMPLOYEES"...I know
that the first column is FirstName and the second column
is LastName, but these are not headers...so the recordset
simply starts with the first name in the range.

Is it possible to use a WHERE criteria with no headers in
this case? I don't know how to identify the fields when
there are no headers.

Thanks,

Seth
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default SQL with no headers

If your data is in a recordset and that is an extract
from a SQL database, then there are 'headers, ie column
names. One cannot create a table in any database without
column names.

If your data is in a recordset called RST then you can
get the 'headers' with a simple for.next loop:-

WITH RST
For i = 0 to .Fields.Count - 1
Cells(1,i+1).Value = .Fields(i).Name
Next
END WITH
Range("A2").CopyFromRecordset RST

HTH

Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
How do you use a WHERE statement if a table has no
headers?

i.e., say there is a table called "EMPLOYEES"...I know
that the first column is FirstName and the second column
is LastName, but these are not headers...so the

recordset
simply starts with the first name in the range.

Is it possible to use a WHERE criteria with no headers

in
this case? I don't know how to identify the fields when
there are no headers.

Thanks,

Seth
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
lookup using column headers and row headers Memphus01 Excel Discussion (Misc queries) 1 April 13th 09 04:57 PM
HEADERS HELP PLEASE! sopranoiam Excel Discussion (Misc queries) 1 February 13th 08 05:01 PM
headers Aamir Excel Worksheet Functions 1 November 13th 06 07:57 PM
Headers Holden Caulfield Excel Discussion (Misc queries) 1 April 26th 06 09:59 PM
Row Headers the_divine_blade Excel Discussion (Misc queries) 4 January 23rd 05 09:31 PM


All times are GMT +1. The time now is 04:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"