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

how do i base one select statement on another

Status
Not open for further replies.

jacq

Technical User
Jan 3, 2001
38
GB
i have created a 1st page and requested the fields, namely pname and parea, on the 2nd page. all but one of the fields are in tblproject, the other's in tblname. i need to say:
"select name from tblname where area = parea", set rs etc, and then
"select * from tblprojects where name = rs(area)...i tried to 'do while not rs.eof' and it gets stuck in a loop
i tried this:
sqlstmt = "Select * from tblproject WHERE '" & pname & "%' In (SELECT name FROM tblname WHERE area= '" & parea & "'), but it says 'Unterminated string constant'

 
sqlstmt = "Select * from tblproject WHERE '" & pname & "%' In (SELECT name FROM tblname WHERE area = '" & parea & "')"
Chad
tinman@thelandofoz.org

Tinman,

Welcome to OZ.
 
thanks
it was the double quote...but also the % in the pname which was adding on to then name and so the database couldn't find a match

sqlstmt = "Select * from tblproject WHERE '" & pname & "%' In
(SELECT name FROM tblname WHERE area = '" & parea & "')"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top