How to put a query that uses another query result in VBA?

Y

Yumex85

Hi!
I´m having the following problem:

I want to put the result of the query below at the "on load" event in a
form.

-----------------------------------------------------------------------------------------------------------------
SELECT FuturosEstoque.ProdutoID, FuturosEstoque.Vencimento,
FuturosCotacoes.Cotacao, FuturosCotacoes.CotacaoAnteriorCorrigida
FROM FuturosEstoque LEFT JOIN FuturosCotacoes ON
(FuturosEstoque.ProdutoID = FuturosCotacoes.ProdutoID) AND
(FuturosEstoque.Vencimento = FuturosCotacoes.Vencimento)
WHERE (((FuturosCotacoes.Cotacao)=0 Or (FuturosCotacoes.Cotacao) Is
Null) AND ((FuturosCotacoes.CotacaoAnteriorCorrigida)=0 Or
(FuturosCotacoes.CotacaoAnteriorCorrigida) Is Null) AND
((FuturosCotacoes.Data)>=[DtCalc] And
(FuturosCotacoes.Data)<=[DtCalc2]) AND ((FuturosCotacoes.ProdutoID) Is
Null));

-------------------------------------------------------------------------------------------------------------------
[Dtcalc] and [Dtcalc2] would be two date parameters which i would get
from 2 different text boxes on the form.
The problem is the table "FuturosEstoque" is the name of another query
in my access database which also needs the same [DtCalc] parameter.
I don´t want to make a temporary table to store my first query result
then to run my second query.

Is there a way to use those 2 queries in VBA without making temporary
table and passing the values for both query parameters?
 

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