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

xls reads sql table, need query to read r1c1 as param

Status
Not open for further replies.

jerryk

Programmer
Jun 13, 2001
82
US
Hello All,

I have a spreadsheet and in r12c1 there is a query I made from the Query Wizard. In the query I have to enter a "Job Number" to get my results.

The problem is, r1c1 contains the Job Number. Can I make the SQL query *read* r1c1?

Here's the SQL:
SELECT Job.User_Values, User_Values.Text2, User_Values.Text3, User_Values.Text4, User_Values.Text5
FROM {oj Production.dbo.Job Job LEFT OUTER JOIN Production.dbo.User_Values User_Values ON Job.User_Values = User_Values.User_Values}
WHERE (Job.Job='24274-24')

I'd like the last line to read:
WHERE (Job.Job='R1C1')
-or-
WHERE (Job.Job='tab!R1C1')

Many Many thanks for any help you all can offer!

Jerry
jerrykarn@hotmail.com


 
where from are u executing the SQL ?

Excel ?

Sql Server ?

VB .NET ?

'cause from excel is easy...

dim a as string

a = activesheet.cells(1,1).value

if u are using VB or anothers

u have to create a OLEOBject

?
..

regards
 
Thanks for your response...

The spreadsheet is connected to our sqlserver database.

In excel I can launch the MS data query builder and connect tables, etc. But the query builder doesn't appear to let me use "cells" as parameters.

To "boil" my problem down to the basics, I'm looking for sql query syntax that can read a cell's data as a parameter:

select * from part_master where part_master.part = r1c1

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top