Combine queries in vba

Combine queries in vba

am 30.11.2007 14:09:36 von Johnie

This is a multi-part message in MIME format.

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

I have query1 where I set a date range. Query2 is a crosstab query and =
is based on query1. I don't want the queries to be saved in the mdb but =
I do want them to be run in VBA using a querystring. If I only put =
query2 in the querystring it refers to query1 which is not available in =
the database. How can I combine the 2 queries into one querystring?

Thank you,
John
------=_NextPart_000_0009_01C8335A.A365F360
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



charset=3Diso-8859-1">




I have query1 where I set a date range. =
Query2 is a=20
crosstab query and is based on query1. I don't want the queries to =
be saved=20
in the mdb but I do want them to be run in VBA using a querystring. =
If I=20
only put query2 in the querystring it refers to query1 which =
is=20
not available in the database. How can I combine the 2 queries into =
one=20
querystring?

 

Thank you,

John


------=_NextPart_000_0009_01C8335A.A365F360--

Re: Combine queries in vba

am 02.12.2007 02:30:50 von CDMAPoster

On Nov 30, 8:09 am, wrote:
> I have query1 where I set a date range. Query2 is a crosstab query and is based on query1. I don't want the queries to be saved in the mdb but I do want them to be run in VBA using a querystring. If I only put query2 in the querystring it refers to query1 which is not available in the database. How can I combine the 2 queries into one querystring?
>
> Thank you,
> John

Instead of combining the queries to obtain a more complex query,
consider leaving in the name of the query contained in the other
database. See:

http://groups.google.com/group/microsoft.public.access/msg/e f639becbdf2faee

James A. Fortune
CDMAPoster@FortuneJames.com

Re: Combine queries in vba

am 02.12.2007 03:17:47 von CDMAPoster

On Dec 1, 8:30 pm, CDMAPos...@fortunejames.com wrote:

> Instead of combining the queries to obtain a more complex query,
> consider leaving in the name of the query contained in the other
> database. See:
>
> http://groups.google.com/group/microsoft.public.access/msg/e f639becbd...

On second thought I don't think this will work. The changes have to
be made in an identical query in the current database that references
the table(s) in the other database. Lyle's syntax from a similar post
to combine the queries is good, but crosstab queries can get complex
enough without having to interact with subqueries. If you are
confortable combining the queries then do that.

James A. Fortune
CDMAPoster@FortuneJames.com

Re: Combine queries in vba

am 02.12.2007 04:48:24 von CDMAPoster

On Dec 1, 9:17 pm, CDMAPos...@fortunejames.com wrote:

> On second thought I don't think this will work. The changes have to
> be made in an identical query in the current database that references
> the table(s) in the other database.

I just tested this out by calling a query in a separate database using
that syntax. My original suggestion works.

James A. Fortune
CDMAPoster@FortuneJames.com

Re: Combine queries in vba

am 02.12.2007 09:49:21 von Johnie

Thanks James. My initial post wasn't very clear so I posted another. I got
it working now.
John

schreef in bericht
news:42a2574e-40f4-40a8-a9d7-2b5a200e5038@w28g2000hsf.google groups.com...
> On Nov 30, 8:09 am, wrote:
>> I have query1 where I set a date range. Query2 is a crosstab query and is
>> based on query1. I don't want the queries to be saved in the mdb but I do
>> want them to be run in VBA using a querystring. If I only put query2 in
>> the querystring it refers to query1 which is not available in the
>> database. How can I combine the 2 queries into one querystring?
>>
>> Thank you,
>> John
>
> Instead of combining the queries to obtain a more complex query,
> consider leaving in the name of the query contained in the other
> database. See:
>
> http://groups.google.com/group/microsoft.public.access/msg/e f639becbdf2faee
>
> James A. Fortune
> CDMAPoster@FortuneJames.com