Queries

Space Cowboy

Member
Local time
Today, 15:59
Joined
May 19, 2024
Messages
245
Good Morning Good People,

Is it possible to grab information from a record, single cell, and use that live as a condition for another query?
 
Yes. But how you do it depends on whether you use vba or perhaps nested queries or even a scratchpad form (hidden) as an interim place to store the desired value.
I presume you mean field when you typed 'cell'?
 
Yes that is correct Nick "Field" Thanks
 
OK. I'll see if I can knock some example queries together. Bit pushed for time right now so patience please :)
 
You can access a record using a query (SQL). It therefore makes sense to stick to the language and not have to refer to other libraries and objects unnecessarily. SQL is also fast and powerful if you use it correctly.
SQL:
SELECT 
   * 
FROM 
   TabA 
WHERE 
   FieldX IN 
      (
         SELECT 
            FieldY 
         FROM 
            TabB 
      )
The queries could also be linked using an INNER JOIN.
 
OK. I'll see if I can knock some example queries together. Bit pushed for time right now so patience please :)
Finally got a couple of mins and lo and behold ebs17 answered. Using an IN clause is a neat way to avoid creating two distinct queries with an inner join, though the latter can be an easier way to derive that clause.

I was also thinking about creating a form which was based on a table containing the criteria and using a vba DAO recordset to retrieve the results to an unbound sub-form etc etc. I favour using SQL IN clause it's neater by far and keeps things simple.
 

Users who are viewing this thread

Back
Top Bottom