
Signature
Jerry Whittle
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
Jerry,
Neither '9999 - ** MUST REASSIGN **' or "9999 - ** MUST REASSIGN **"
seemed to make any difference.
It sure blew up bigger/worse/quicker when it was either
'9999 - ** MUST REASSIGN! **' or "9999 - ** MUST REASSIGN! **" though.
I did not try playing with the *s though.
Interestingly, my original SQL:
SELECT KOSTL, NAME, SAP_PLANT_NO FROM (SELECT SAP_PLANT_NO, KOSTL,
[KOSTL] & " - " & [KTEXT] AS NAME FROM tblPlantCostCenters UNION SELECT
DISTINCT SAP_PLANT_NO, "9999" AS KOSTL, "9999 - ** MUST REASSIGN! **" AS
NAME FROM tblPlantCostCenters) WHERE
(SAP_PLANT_NO=[Forms]![frmIncidentAdd]![Location]);
got instantly mangled, becoming something like:
SELECT KOSTL, NAME, SAP_PLANT_NO FROM [SELECT SAP_PLANT_NO, KOSTL,
[KOSTL] & " - " & [KTEXT] AS NAME FROM tblPlantCostCenters UNION SELECT
DISTINCT SAP_PLANT_NO, "9999" AS KOSTL, "9999 - ** MUST REASSIGN]![ **" AS
NAME FROM tblPlantCostCenters]. AS [%&@^ABCD] WHERE
((SAP_PLANT_NO)=Forms!frmIncidentAdd!Location);
Note that the ""s around "999 - ** MUST REASSIGN! **" were somehow ignored
when the parser saw the ! which became ]![ regardless of the fact that it was
within a double-quoted string literal.
I thought the ()s around the UNION sub-query becoming []s and followed by a
. (or at least, it LOOKED like a period) before the "AS ..." was interesting
too. This continued to happen even after I removed the ! from the quotated
literal string.
(I can handle the auto-generated name, I've no fears there, but it is an
_interesting_ auto-naming style though.)
All this happened after _retrieving_ the SQL string from the querydef -
either via the immediate window via
strMySQL = currentdb.querydefs("myQuery").SQL
or by opening the query in the designer (in either SQL or design views).
If I simply saved the query string (by directly assigning the string to the
querydef's .SQL property in the immediate window) and then opened the form
which used it for a combo-box list source, it ran perfectly as expected!
Open the query in the designer, allow it to save the query, and try the form
again... *ka-boom!* Invalid Bracketing.
> What happens when you put double quotes in place of the four single quotes?
>
[quoted text clipped - 34 lines]
> > Windows XP Sp2-level patching for Jet 4.0 - msjet40.dll & msjtes40.dll
> > 4.00.8618.0)
Mark Burns - 31 May 2006 15:04 GMT
Oh, just to clarify, the auto-generated name for the sub-query was:
"[%$##@_Alias]"
> Jerry,
>
[quoted text clipped - 81 lines]
> > > Windows XP Sp2-level patching for Jet 4.0 - msjet40.dll & msjtes40.dll
> > > 4.00.8618.0)