Want to make query dependent on another query.
Hello to all,
I am working on project where I am using Microsoft Access 2003 as back end. In Access 2003 I have created 10 fields, on that fields I have to create query. I want to create query on these fields in such a manner that one dependent on the other. It means when one query execute it's dependent query is automatically executed. Can anyone help me to how to make query dependent on another query. Please help me.
Thank you.
Re: Want to make query dependent on another query.
Hey it is very simple to create query dependent on another query. You have to just embed one query's name into another. In this way you have to insert one query's name into another to achieve the result. I have written following code for creating one query dependent on another query. Just try to understand it.
Code:
SELECT tableName.[Companys], tableName.[Companys] FROM tableName where not(tableName.[Companys]) is null UNION SELECT "*", "<All>" From tableName
ORDER BY 2;
Re: Want to make query dependent on another query.
It is very simple to make one query dependent on another query. You have to use general approach that means you have to use UNION query to achieve this. Just use UNION query and add "<All>" option to it. This "<All>" option is "translated" by the another or second combo query column into a "*". Which is used to enable a LIKE statement in the query. After this you have to force the user to make a selection.
Re: Want to make query dependent on another query.
You have to create row source to the company table to make query dependent on another query. It is very simple process. You have to just use following SQL query in your program to achieve this. Just try to understand it. It is very simple.
Code:
SELECT tableName.[Company], tableName.[Company] FROM tableName where not(tableName.[Company]) is null UNION SELECT "*", "<All>" From tblName
ORDER BY 2;
"Order by" is used to combine two or more records.
Re: Want to make query dependent on another query.
You have to make following setting in your code to achieve this. Just open the query where the record source of the combo box are present. It is the query with the union option. For testing this query you have to create a new empty query. After this paste the "real" query text without the "<All>" union part. After this insert name of first query into another one.