Variables within SQL.REQUEST

E

Eliezer

Hello... yesterday I posted a question regarding linking
access and excel, and I was told I can do it via
SQL.REQUEST. Everything works now, but one thing would
save me lots of grunt work. Is there a way to link excel
into the SQL request? For instance, my request looks like
this:

=SQL.REQUEST("DSN=CDAA", D8, 4, "Select ID,TIMEPT,CLEANED
FROM ALIFE WHERE (ID=1 AND TIMEPT=0)", FALSE)

Is there any way to get the variables "ALIFE", "ID",
and "TIMEPT" to be dependant upon valuse in an excel cell?
I tried this:

=SQL.REQUEST("DSN=CDAA", D8, 4, "Select ID,TIMEPT,CLEANED
FROM $B1 WHERE (ID=($C$3) AND TIMEPT=(D$5))", FALSE)

and it didn't work (it returned #N/A!). Thanks in advance!
 
F

Frank Kabel

Hi
try
=SQL.REQUEST("DSN=CDAA", D8, 4, "Select ID,TIMEPT,CLEANED FROM " & $B1
& " WHERE (ID=(" & $C$3 & ") AND TIMEPT=(" & D$5 & "))", FALSE)

HTH
Frank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top