i have a form with an option group (two options). if option1 is selected i
want to create a query named "query1" and delete the previous one. the query
should draw data from another query. if option2 is selected i want to create
again a query named "query1" and delete the previous one but the query
should draw data from two different queries this time. can i achieve
something like that and if yes how? i would save considerable time
redesigning my database if you help me solve this problem. i assume that code
would be the only way, but i do not have a clue! pls be specific!
You did not say what the purpose of Query1 was to be. The only reason I can
figure is that both would feed the same form or report. If this is the case
then there is an easier way.
Create the two queries naming them "X" & "Y" and include a field Expr1: 1
for "X" and a field Expr1: 2 for "Y" selection purposes. In the criteria for
Expr1 use [Forms]![YourFormName]![Frame1].
Then use both in a union query. Only the query that Expr1 matches the
option will output records.

Signature
KARL DEWEY
Build a little - Test a little
> i have a form with an option group (two options). if option1 is selected i
> want to create a query named "query1" and delete the previous one. the query
[quoted text clipped - 4 lines]
> redesigning my database if you help me solve this problem. i assume that code
> would be the only way, but i do not have a clue! pls be specific!
angie - 18 Apr 2008 16:33 GMT
query1 returns all records of my table and query2 returns specific records
from my table. what does [frame1] stand for? is that the option group name?
how do i have to put the sql for the union query?
Ο χρήστης "KARL DEWEY" έγγραψε:
> You did not say what the purpose of Query1 was to be. The only reason I can
> figure is that both would feed the same form or report. If this is the case
[quoted text clipped - 13 lines]
> > redesigning my database if you help me solve this problem. i assume that code
> > would be the only way, but i do not have a clue! pls be specific!