Posted on 1998-04-03
Now, I want to learn how to write a SQL subquery. In a standard module I have lots of functions to return SQL strings to make recordsets under different circumstances. Sometimes I want to delete some of the records after calling one of the functions. First I make a recordset wich is always correct:
Set RS_Search = DB_Search.OpenRecordset(SQL)
Here's the SQL string:
"SELECT * FROM " & Table & " ORDER BY [Year], [Num];"
And now, if AUTHORITY is 1 I want to extract the records that doesn't have Status = F. Something like this, I thought:
NewSQL = "SELECT * FROM " & Table & " WHERE [Status] <> 'F' IN (" & SQL & ");"
Set RS_Search = DB_Search.OpenRecordset(NewSQL)
Unfortunately it doesn't work. How can I make it work without having to write the second query in all the functions?