SandieT04
asked on
Weird Column Name
Still trying to get this report out!! Have the following query that returns a weird name for the "Client" column and I need to query this query but cannot accurately reference that column. HELP!
SELECT Client.[Soc Sec #], Client.Client, [FAPT Query Max Date].MaxOfDate, Client.DOB, Client.Sex, Client.Race, Client.Referral, Client.[CSA Start], Encumbrance.[Service/Place ment Type] As SvcType, Sum(Encumbrance.Encumbered ) AS Encumbrd,Sum(Encumbrance.A djustment) AS Adj, Sum(0) AS Expend
FROM (Client INNER JOIN Encumbrance ON Client.Client=Encumbrance. Client) INNER JOIN [FAPT Query Max Date] ON [FAPT Query Max Date].Client = Client.Client
WHERE (Encumbrance.[FY 04-05]=Yes)
GROUP BY Client.[Soc Sec #], Client.Client, [FAPT Query Max Date].MaxOfDate, Client.DOB, Client.Sex, Client.Race, Client.Referral, Client.[CSA Start], Encumbrance.[Service/Place ment Type]
UNION
SELECT Client.[Soc Sec #], Client.Client, [FAPT Query Max Date].MaxOfDate, Client.DOB, Client.Sex, Client.Race, Client.Referral, Client.[CSA Start], [Invoice Table].[Service/Placement Type] As SvcType, Sum(0) AS Encumbrd, Sum(0) AS Adj, Sum([Invoice Table].Amount) AS Expend
FROM (Client INNER JOIN [Invoice Table] ON Client.Client=[Invoice Table].Client) INNER JOIN [FAPT Query Max Date] ON [FAPT Query Max Date].Client = Client.Client
WHERE (([Invoice Table].[Check Date] Between #7/1/2004# And #9/30/2004#) And ([Invoice Table].[Account Number]<>"05309-9162"))
GROUP BY Client.[Soc Sec #], Client.Client,[FAPT Query Max Date].MaxOfDate, Client.DOB, Client.Sex, Client.Race, Client.Referral, Client.[CSA Start], [Invoice Table].[Service/Placement Type];
The result has the "Client" Column as something like X7YZ_____1.Client
Why is it doing this and how do I reference the column in another query?
Sandie
SELECT Client.[Soc Sec #], Client.Client, [FAPT Query Max Date].MaxOfDate, Client.DOB, Client.Sex, Client.Race, Client.Referral, Client.[CSA Start], Encumbrance.[Service/Place
FROM (Client INNER JOIN Encumbrance ON Client.Client=Encumbrance.
WHERE (Encumbrance.[FY 04-05]=Yes)
GROUP BY Client.[Soc Sec #], Client.Client, [FAPT Query Max Date].MaxOfDate, Client.DOB, Client.Sex, Client.Race, Client.Referral, Client.[CSA Start], Encumbrance.[Service/Place
UNION
SELECT Client.[Soc Sec #], Client.Client, [FAPT Query Max Date].MaxOfDate, Client.DOB, Client.Sex, Client.Race, Client.Referral, Client.[CSA Start], [Invoice Table].[Service/Placement Type] As SvcType, Sum(0) AS Encumbrd, Sum(0) AS Adj, Sum([Invoice Table].Amount) AS Expend
FROM (Client INNER JOIN [Invoice Table] ON Client.Client=[Invoice Table].Client) INNER JOIN [FAPT Query Max Date] ON [FAPT Query Max Date].Client = Client.Client
WHERE (([Invoice Table].[Check Date] Between #7/1/2004# And #9/30/2004#) And ([Invoice Table].[Account Number]<>"05309-9162"))
GROUP BY Client.[Soc Sec #], Client.Client,[FAPT Query Max Date].MaxOfDate, Client.DOB, Client.Sex, Client.Race, Client.Referral, Client.[CSA Start], [Invoice Table].[Service/Placement Type];
The result has the "Client" Column as something like X7YZ_____1.Client
Why is it doing this and how do I reference the column in another query?
Sandie
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In the interest of trying the most basic things first: have you tried using brackets to delimit at least that column: [client].[client] to see if that makes the strange behavior stop?
You're using Client as both a table name and field name, which is probably confusing the query compiler. Rename one of them.
Also, don't have spaces in table, query, and field names. Spaces mean you have to refer to them with square brackets [ ] in VBA and queries.
Hope this helps.
-Jim
Also, don't have spaces in table, query, and field names. Spaces mean you have to refer to them with square brackets [ ] in VBA and queries.
Hope this helps.
-Jim
ASKER
I could have sworn I aliased it and it didn't work ! I think I'm feeling the pressure!! ;-) Thanks!!
SELECT Client.[Soc Sec #], Client.Client as [Client], [FAPT Qu...