Link to home
Start Free TrialLog in
Avatar of SandieT04
SandieT04Flag for United States of America

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/Placement Type] As SvcType, Sum(Encumbrance.Encumbered) AS Encumbrd,Sum(Encumbrance.Adjustment) 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/Placement 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
Avatar of jdlambert1
jdlambert1
Flag of United States of America image

SITD... In the first SELECT clause only, try:

SELECT Client.[Soc Sec #], Client.Client as [Client], [FAPT Qu...
ASKER CERTIFIED SOLUTION
Avatar of shanesuebsahakarn
shanesuebsahakarn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pique_tech
pique_tech

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?
Avatar of Jim Horn
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
Avatar of SandieT04

ASKER

I could have sworn I aliased it and it didn't work !   I think I'm feeling the pressure!!  ;-)  Thanks!!