Re: Simply confused - Query stopped working
- From: QB <QB@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 3 Dec 2009 12:47:02 -0800
I've isolated the problem, but don't understand. Perhaps you have an
explanation. Here is my sql for the 2 queries (and yes I know there are
issues with naming conventions, table structure... - I took over another
developer mess - One problem at a time)
SELECT [900-PARAMETRE].[900-01_NUMÉRO] AS [Numéro de projet],
[900-PARAMETRE].[900-02_NOM], IIf([900-PARAMETRE].[Type
A]=True,"A",IIf([900-PARAMETRE].[Type B]=True,"B","C")) AS Type,
[900-PARAMETRE].[910 STATU] AS Statut, [900-PARAMETRE].[900-05_DEBUT DU
PROJET], [900-PARAMETRE].[900-07_LIVRAISON REELLE], [900-PARAMETRE].dtStatut,
[900-PARAMETRE].[900-03_CHARGÉ DE PROJET] AS [Chargé de projet], ((([Prix de
vente]+[Facture des chgs])-([Total ETC]+[Total AC]))/([Prix de
vente]+[Facture des chgs]))-((([Prix de vente]+[Facture des
chgs])-([Coutant]+[Coutant des chgs]))/([Prix de vente]+[Facture des chgs]))
AS Marge
FROM [900-PARAMETRE] INNER JOIN qry_Dashboard ON
[900-PARAMETRE].[900-01_NUMÉRO] = qry_Dashboard.[Numéro de Projet]
WHERE ((([900-PARAMETRE].[900-01_NUMÉRO]) Is Not Null))
ORDER BY [900-PARAMETRE].[900-01_NUMÉRO];
SELECT qry_rpt_RespectMarge01.[Numéro de projet],
qry_rpt_RespectMarge01.[900-02_NOM], qry_rpt_RespectMarge01.Type,
Year([900-05_DEBUT DU PROJET]) AS Livrable,
qry_rpt_RespectMarge01.[900-07_LIVRAISON REELLE],
qry_rpt_RespectMarge01.dtStatut, qry_rpt_RespectMarge01.[Chargé de projet],
qry_rpt_RespectMarge01.Marge, CouleurMarge([Marge]) AS [Couleur Marge]
FROM qry_rpt_RespectMarge01
WHERE (((Year([900-05_DEBUT DU
PROJET]))=[Forms]![frm_rpt_RespectMarge]![cbo_Livrable]) AND
((qry_rpt_RespectMarge01.[Chargé de projet]) Like
IIf([Forms]![frm_rpt_RespectMarge]![cbo_Charge]="Tous","*",[Forms]![frm_rpt_RespectMarge]![cbo_Charge]))
AND ((qry_rpt_RespectMarge01.Marge) Is Not Null) AND
((qry_rpt_RespectMarge01.Statut) In ("Fermé")));
After some troubeshooting I now know that the issue is with the
((qry_rpt_RespectMarge01.Marge) Is Not Null) part of the query. If I remove
it, it runs fine. If I put <>"", it runs fine. It is specifically because
of the Is Not Null. Why would this pose a problem?
Thank you for your help.
QB
"Jeff Boyce" wrote:
Your first line of defense/fall back is to restore these queries from your.
most recent backup ... you DO have backups, right?
If not, a second option would be to scrap both queries and rebuild them, and
see if the new version works (Access sometimes suffers subtle corruption ...
it can be faster to throw out the old and start over).
Another approach would be to (first, make a backup!) use Compact & Repair to
see if this finds/fixes the issue.
Is your db compiled? Open a module, use Debug, and compile it if it isn't.
Good luck!
Regards
Jeff Boyce
Microsoft Access MVP
--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.
Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.
You can thank the FTC of the USA for making this disclaimer
possible/necessary.
"QB" <QB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FB53EFC9-FF15-4F7F-A5E9-63CFACC6CC2B@xxxxxxxxxxxxxxxx
I have a db that is on it's 3rd year of usage and development. A while
back
I created a complex report built upon a set of queries. It has always
worked
without issue.
I recently did some work to the db, but in no way touch this report,
queries
or underlying tables, and now I it won't work.
I traced the issue to the queries.
In a first queries I have a field that is a calculated field (simple + -
/).
The first query runs fine.
Now I have a 2nd query built upon the first in which I reference this
above
mentioned calculated field. For some reason, the 2nd query spits out that
the expression is too complex... If I remove the field, it works. The
field
is also used in another field in an iif () expression and that works fine,
but simple refering to it alone, generates this error.
How can it be too complexe since it gets calculated without issue in the
first Query and since I can use it in a iif() expression?
What is going on here? Anyone have any ideas?!
Thank you,
QB
.
- Follow-Ups:
- Re: Simply confused - Query stopped working
- From: Jeff Boyce
- Re: Simply confused - Query stopped working
- References:
- Simply confused - Query stopped working
- From: QB
- Re: Simply confused - Query stopped working
- From: Jeff Boyce
- Simply confused - Query stopped working
- Prev by Date: Re: need help removing zeros with Left or right??
- Next by Date: RE: Sumarize data in Query like in a Pivot Table
- Previous by thread: Re: Simply confused - Query stopped working
- Next by thread: Re: Simply confused - Query stopped working
- Index(es):
Relevant Pages
|