Re: Query the Query

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi K,

The first approach would suit the best, any chance you could guide me in the
correct format as I have (obviously lol) never created one before.

Many Thanks

Andy

"K Dales" <KDales@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0EF99836-96D6-40CF-9B24-1A834D3EAFB9@xxxxxxxxxxxxxxxx
Since your first query does an update there is no "result set" stored, so
you
would need to requery using the same criteria.
Two approaches:
1) in addition to the update query have a make-table query using the same
criteria - you could call the table something like tblLastQuery and keep
overwriting it so you save a copy of the last result set. Then your
second
query would use this table instead of tblMailingList.
2) You could save the prior query criteria in a separate (string) variable
to re-use for the second query. Not sure if you want to repeat the update
but if that is your intent it would be similar to this:
If lstDataSource.Value = "Main Database" Then
STRSQL = "UPDATE tblMailingList SET SelectForView=-1,
SelectForPreView=-1 Where " & gcriteria & ";"
lastcriteria = gcriteria
DoCmd.RunSQL STRSQL
ElseIf lstDataSource.Value = "Last Search" Then
STRSQL = "UPDATE tblMailingList SET SelectForView=-1,
SelectForPreView=-1 Where " & gcriteria & " And " & lastcriteria & ";"
lastcriteria = gcriteria & " And " & lastcriteria
End If

--
- K Dales


"andy g" wrote:

Hi,

Could you please show me how to query the results of a query

I have some query code:
If lstDataSource.Value = "Main Database" Then
STRSQL = "UPDATE tblMailingList SET SelectForView=-1,
SelectForPreView=-1 Where " & gcriteria & ";"
DoCmd.RunSQL STRSQL
ElseIf lstDataSource.Value = "Last Search" Then

End If

where gcriteria = lstSelectFrom.Value & " LIKE '" & txtSearchParameter &
"*'"

This returns the results exactly as i need.

My question is, what do I need to place in the code for
lstDataSource.Value
= "Last Search" which will filter the results of the previous query from
the
main database

Any Ideas most welcome, Thanks





.



Relevant Pages

  • Re: improving performance by indexing query criteria fields
    ... establish relationships first in the relationships window. ... My advice is to index fields that you use to specify criteria and sort orders. ... important in a multi-user database, where the back-end is on a file server. ... appropriate records (assuming the query optimizer can use the index). ...
    (microsoft.public.access.setupconfig)
  • Re: improving performance by indexing query criteria fields
    ... establish relationships first in the relationships window. ... My advice is to index fields that you use to specify criteria and sort orders. ... important in a multi-user database, where the back-end is on a file server. ... appropriate records (assuming the query optimizer can use the index). ...
    (microsoft.public.access.queries)
  • Re: Showing certain record only
    ... In my database I have a toggle button that once pressed ... My Main form is called frmProject which gets it data from a query ... unbound textbox, txtZeros. ... I add the following criteria to the filtering query for the listbox, ...
    (microsoft.public.access.forms)
  • Re: Database Results Using Page Variable
    ... You can modify the Pick list example to use a hyperlink to pass the query (your criteria) ... Right above the 1st grey code just enter the ASP code to get the query value from the sending page ... But the database results in the include page should show ...
    (microsoft.public.frontpage.programming)
  • Re: DBMS and lisp, etc.
    ... Naively implemented with SQL, again for 10 ... (1 query for the initial orders, 1 query for each order for its ... soon as you upgrade to the SQL database. ... (eq (order-customer orderA) ...
    (comp.lang.lisp)