create query from option group

A

angie

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!
 
K

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
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.
 
A

angie

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
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.

--
KARL DEWEY
Build a little - Test a little


angie said:
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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top