(Mike Mitchell)
8/31/2011 4:56:00 PM
I need a more complicated query than usual. So far the only way I have
managed to achieve the final recordset I want is by creating two
queries (in Access 97), then a third query that 'links' the two, as
follows:
QueryFirstWord:
SELECT RecordNumbers.DX_ID
FROM SubjectKeywords INNER JOIN RecordNumbers ON
SubjectKeywords.SK_ID = RecordNumbers.SK_ID
WHERE (((SubjectKeywords.SK_Keyword)=[First Keyword:]));
QuerySecondWord:
SELECT RecordNumbers.DX_ID
FROM SubjectKeywords INNER JOIN RecordNumbers
ON SubjectKeywords.SK_ID = RecordNumbers.SK_ID
WHERE (((SubjectKeywords.SK_Keyword)=[Second Keyword:]));
QueryCombine:
SELECT QueryFirstWord.DX_ID
FROM QueryFirstWord INNER JOIN QuerySecondWord ON
QueryFirstWord.DX_ID = QuerySecondWord.DX_ID;
So, in Access 97, I run QueryCombine, input the First Keyword then the
Second Keyword when prompted, and I get my desired recordset
consisting of only the DX_IDs common to both.
I could, using parameter queries, 'call' the above queries in VB6, but
I'd rather just build a SQL string that combines all of the above
within VB. I think what I need is a "subquery", but I am no SQL guru!
Any comments? I shall keep plugging away here, so I may come up with a
solution myself.
Thanks.
MM