Re: Access doesn't like its own SQL
- From: Allen_N <AllenN@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 12 Dec 2006 20:15:01 -0800
Thanks, Gunny. That worked a treat.
I guess Access' [%$##@_Alias] thing is like the 'AS DerivedTable' syntax
recommended in T-SQL.
"'69 Camaro" wrote:
Hi, Allen..
Any advice?
When editing a Jet-induced pain, replace the opening bracket and closing
bracket of the subquery with opening and closing parentheses, then assign
your own alias name (avoiding reserved words and illegal identifiers). For
example, change:
SELECT KitItem
FROM [SELECT KitItem
FROM SubKits
WHERE SubKits.ITEM = '600-211-1231']. AS [%$##@_Alias]
WHERE (DateCreated >= #12/1/2006#)
. . . to:
SELECT KitItem
FROM (SELECT KitItem
FROM SubKits
WHERE SubKits.ITEM = '600-211-1231') AS Alternator
WHERE (DateCreated >= #12/1/2006#)
HTH.
Gunny
See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.
"Allen_N" wrote:
I'm trying to modify my original query, and I'm being plagued by this
auto-generated non-reusable alias rubbish again.
Stefan said it was fixed in Access 2003; but, I am using 2003, and it ain't
fixed!
Any advice?
"Stefan Hoffmann" wrote:
hi Allen,
Allen_N wrote:
Here's a weird one. The codeThis alias is need by Jet to run the query. Access use this not so nice
Set qy = CurrentDb.QueryDefs(strSourceQuery)
strSQL = qy.SQL
Set qy = CurrentDb.QueryDefs("Kits Found Special")
qy.SQL = strSQL
produces error 3131: "Syntax error in FROM clause", despite the fact that
the 1st query works fine if run from the database window.
(note that Access added the "]. AS [%$##@_Alias]" foolishness, not I).
default alias, which is not reusable as you have noticed.
The simple solution is to use a extra query for your subselect.
btw, under Access 2003 this probem is fixed.
mfG
--> stefan <--
- Follow-Ups:
- Re: Access doesn't like its own SQL
- From: '69 Camaro
- Re: Access doesn't like its own SQL
- Prev by Date: Re: Auto Fill In Combo Box From Combo Box
- Next by Date: Re: Auto Fill In Combo Box From Combo Box
- Previous by thread: Re: Why is this query so slow?
- Next by thread: Re: Access doesn't like its own SQL
- Index(es):
Relevant Pages
|