Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do I take response from a query and place in a query?

Status
Not open for further replies.

ggreg

Programmer
Mar 9, 2001
201
US
How do I take response from a query and place in a query,

If I code a button to run a certain query which is one of
four condition. How can I then take information from that
query which show be three fields and place in another query.

the first query will give me anywhere from 1 to 5 lines
of data

example code type number
line 1 a tc 10
line2 B MC 5
line3 F AC 18
 
Are you asking if you can run the first query and then perform a second query on the results of the first query?
Example: fist query returns these records
Johnny Admin 123333
Suanne Recep 333929
Debbie Admin 492999
And you want to do a second query to select all the Admin from the results.

Or do you want to analyze the results of the first query and base the criteria of the second query on that analysis.
Example: fist query returns these records
Johnny Admin 123333
Suanne Recep 333929
Debbie Admin 492999

And if the query results in more than 4 records, run Query 3, if no records, Query 4, etc.
 
Are you asking if you can run the first query and then perform a second query on the results of the first query?
Example: fist query returns these records
Johnny Admin 123333
Suanne Recep 333929
Debbie Admin 492999
And you want to do a second query to select all the Admin from the results.

yes I want to use first query result to query another
but will be using two of three fields for all three lines
in your example....but be aware that sometime my results of
first query will have 1,2,3,4 or 5 lines.

Johnny 123333
Suanne 333929
Debbie 492999


 
I think I know what you're asking. Set up the first query as normal. Start a new query, but instead of using a table for the recordsource, use the first query. When the second query runs, it will only use the records returned by the first query. You can then pick whatever fields from the first query that you need.
Will that do it?
 
That might have worked but in the criteria
of the second query, but I have to use a between statement I
will be getting back two number fields in first query
along with a text field ...I would like to
do something like what is done with a form.....in a query
criteria....[forms]![frmname]![fieldname]....but it would
not be that easy because for each line that is returned
I would need a line in the criteria of the second query....
Secondly, I am looking to do this in the click event of a button which runs the first query....I will after working
this out build a report on the second query that when button
is click just shows the report
 
In the criteria for the Between statement, are both fields from the same record? If so, you could substitute your field names in your Between statement
Between [firstnumberfield] and [secondnumberfield]

where these fields are results of the first query
 
JoyInOK,

Thanks for your help, I am not sure if we were on the
same page by the way I was stating the problem, but
you got me to take a closer look at using two queries
without using much code
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top