Queries in VBA

Queries in VBA

am 01.12.2007 18:27:43 von Johnie

This is a multi-part message in MIME format.

------=_NextPart_000_009E_01C83447.DD46DBB0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I have query1 and query2. Query2 is based on query1. I would like to =
build those queries in a string in VBA and then execute them. In query2 =
there is a reference to query1. How can I change this reference to the =
querystring of query1 build in VBA?

Thanks,
John
------=_NextPart_000_009E_01C83447.DD46DBB0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



charset=3Diso-8859-1">




I have query1 and query2. Query2 is =
based on=20
query1. I would like to build those queries in a string in VBA and then =
execute=20
them. In query2 there is a reference to query1. How can I change this =
reference=20
to the querystring of query1 build in VBA?

 

Thanks,

John


------=_NextPart_000_009E_01C83447.DD46DBB0--

Re: Queries in VBA

am 02.12.2007 00:17:30 von Lye Fairfield

wrote in news:fis5ib$2aqd$1@textnews.wanadoo.nl:

> I have query1 and query2. Query2 is based on query1. I would like to
> build those queries in a string in VBA and then execute them. In
> query2 there is a reference to query1. How can I change this reference
> to the querystring of query1 build in VBA?

SELECT SQ.School, SQ.SumEnrolment FROM
(SELECT School, SUM(Enrolment) AS SumEnrolment
FROM Enrolments
GROUP BY School) AS SQ
WHERE SQ.SumEnrolment>500
ORDER BY SQ.SumEnrolment

IN pre-JET 4.0
SELECT SQ.School, SQ.SumEnrolment FROM
[SELECT School, SUM(Enrolment) AS SumEnrolment
FROM Enrolments
GROUP BY School]. SQ
WHERE SQ.SumEnrolment>500
ORDER BY SQ.SumEnrolment

with
"SELECT School, SUM(Enrolment) AS SumEnrolment
FROM Enrolments
GROUP BY School"
being "query2"

--
lyle fairfield

Re: Queries in VBA

am 02.12.2007 01:02:42 von Johnie

Thanks Lyle!

"lyle fairfield" schreef in bericht
news:eYl4j.17399$xa2.2054@read2.cgocable.net...
> wrote in news:fis5ib$2aqd$1@textnews.wanadoo.nl:
>
>> I have query1 and query2. Query2 is based on query1. I would like to
>> build those queries in a string in VBA and then execute them. In
>> query2 there is a reference to query1. How can I change this reference
>> to the querystring of query1 build in VBA?
>
> SELECT SQ.School, SQ.SumEnrolment FROM
> (SELECT School, SUM(Enrolment) AS SumEnrolment
> FROM Enrolments
> GROUP BY School) AS SQ
> WHERE SQ.SumEnrolment>500
> ORDER BY SQ.SumEnrolment
>
> IN pre-JET 4.0
> SELECT SQ.School, SQ.SumEnrolment FROM
> [SELECT School, SUM(Enrolment) AS SumEnrolment
> FROM Enrolments
> GROUP BY School]. SQ
> WHERE SQ.SumEnrolment>500
> ORDER BY SQ.SumEnrolment
>
> with
> "SELECT School, SUM(Enrolment) AS SumEnrolment
> FROM Enrolments
> GROUP BY School"
> being "query2"
>
> --
> lyle fairfield