Re: Need help trying to combine queries into 1 query

Tech-Archive recommends: Fix windows errors by optimizing your registry



Chris,

Maybe my setup is the issue.

I'm running WinXP S-P 1, Access 97 SR-2. I'm not sure what version of Jet
I'm running, but the only numbers I could find was 2.x and 3.5.

If I had to guess, I'd assume my problem is the fact I'm using Access 97.

Thanks again,
Jay

"Chris2" wrote:

>
> "Jay" <Jay@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:177220FD-DDEF-4984-9AA1-36E4B9264653@xxxxxxxxxxxxxxxx
> > Chris,
> >
> > I'm not currently generating the query statement in VBA yet. What
> I had
> > planned on doing was verifying the SELECT statement worked in a
> normal Access
> > 97 query. Once I got that working as I needed it, I would use
> that to help
> > me create the query in VBA. So currently the query exists as only
> an Access
> > query.
> >
> > The entire SELECT statement that I've tried to create is as
> follows
> > (formatted to improve readability):
> >
> > SELECT DISTINCT qryOne.DTL_ITEM_NUM, qryOne.DTL_AREA_NUM,
> > qryOne.ItemsReviewed, qryTwo.DefectsSum
> > FROM (SELECT tblDetail.DTL_ITEM_NUM AS qIN, tblDetail.DTL_AREA_NUM
> AS qAN,
> > Sum(tblDetail.DTL_QUAN) AS ItemsReviewed
> > FROM tblDetail
> > GROUP BY tblDetail.DTL_ITEM_NUM,
> tblDetail.DTL_AREA_NUM) AS qryOne
> > LEFT JOIN (SELECT tblDefectCount.DC_ITEM_NUM,
> tblDefectCount.DC_AREA_NUM,
> > Sum(tblDefectCount.DC_DF_QUAN) AS DefectsSum
> > FROM tblDefectCount
> > GROUP BY tblDefectCount.DC_ITEM_NUM,
> > tblDefectCount.DC_AREA_NUM) AS qryTwo
> > ON (qryOne.DTL_AREA_NUM = qryTwo.DC_AREA_NUM) AND
> (qryOne.DTL_ITEM_NUM =
> > qryTwo.DC_ITEM_NUM);
> >
> > The error I get is: Syntax error in FROM clause.
> >
> > I'm going to try running it in VBA, to see if there is also an
> error when
> > run using DoCmd.RunSQL. I haven't tried that yet. If I do and it
> works,
> > I'll post an update.
> >
> > Hope that answers everything. I really appreciate your help.
> >
> > Thanks,
> > Jay
> >
> > "Chris2" wrote:
> >
>
> Jay,
>
> When I copy and paste that query into a QueryDef and try to save it,
> it saves and returns no errors.
>
> I am running Win2k SP-3, Access 2k SP-3, JET 4.0 SP-8
>
> What are you running?
>
>
> Sincerely,
>
> Chris O.
>
>
>
.



Relevant Pages