View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Geoff Geoff is offline
external usenet poster
 
Posts: 371
Default SQL Select string

So the WHERE clause should read something like:

WHERE fieldname = Last Name, Keycode, First Name and the other specific
headers I am looking for.

Is this possible working with lists in .xls wbooks?

Geoff

"Geoff" wrote:

That would give me the contents of columns LastName and KeyCode with filters
myName and myCode.

I am just reading the first row of multiple Excel wbooks. This is to
establish data patterns. Column names are random and specific names (if they
are there) can be in any column order.

Wbook1 keycode Source Title
Wbook2 List code Honorific Forename Surname keycode etc etc

Geoff

"Bob Phillips" wrote:

szSQL = "SELECT * FROM [" & SourceSheet$ & "$" & SourceRange$ & "] " & _
"WHERE LastName = '" & myName & "' AND KeyCode = '" & myCode
& "';"


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Geoff" wrote in message
...
Hi
I use ADO to get the first row of data from multiple unopened wbooks.
This string gets the contents of every cell in row 1 given that
SourceSheet
= "Sheet1" and SourceRange = "A1:IV1"

szSQL = "SELECT * FROM [" & SourceSheet$ & "$" & SourceRange$ & "];"

Instead of all the row how can I write a string to result in specific
names
eg Last Name, Keycode, Company etc?

T.I.A.

Geoff