Modify access query to replace value with an "X"

Hi, I am trying to modify the query to subsitute the letter X for the Crosstab value.  Goal: if the same description is listed under one or more ActivityClasses Categories (Age groups) then place a X under the heading instead of the Autonumber row ID that is associated with a Activity Description.

This is what I have below and I was trying to use with the existing query by placiing it in the Value Criteria field but no luck.  Please tell me what I am dointg wrong.  The ActivityDescription field is a text field, the AQctivityField is a Text field and the ID field is a autonumber field.

IIf(IsNotNull),"substitute text",[X])

Existing Results
*******************
ActivityDescription                       5_6AgeGroup    7_10AgeGroup   11-15ageGroup
Jump off a rope                                       3                       13                         48                              
swim around the park.until dark                                                                     5

Goal Results  
***************
ActivityDescription                       5_6AgeGroup    7_10AgeGroup   11-15ageGroup
Jump off a rope                                       X                        X                         X                              
swim around the park.until dark                                                                    X

Thank you in advance,
TRANSFORM First([tblDetail].ID) AS FirstOfID
SELECT [tblDetail].ActivityDescription
FROM [tblDetail]
GROUP BY [tblDetail].ActivityDescription
PIVOT [tblDetail].ActivityClass;

Open in new window

cesemjAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pteranodon72Commented:
(assuming your ActivityClass fields are fixed, you can:

Leave your crosstab query as it is (existing results), and let's pretend it is named qryCT.

Create a new Select Query:

SELECT ActivityDescription, Iif(IsNull([5_6AgeGroup], "", "X"), Iif(IsNull([7_10AgeGroup], "", "X"), Iif(IsNull([11_15AgeGroup], "", "X") FROM qryCT


HTH,

pT
0
pteranodon72Commented:
Of course, you may want to alias the fields:

SELECT ActivityDescription,
Iif(IsNull([5_6AgeGroup], "", "X") AS [5_6Group],
Iif(IsNull([7_10AgeGroup], "", "X") AS [7_10Group],
Iif(IsNull([11_15AgeGroup], "", "X") AS [11_15Group]
FROM qryCT;

HTH,
pT
0
cesemjAuthor Commented:
Correct me if I am wrong the table that contains the ActivityClases are fixed because the field valuse do not change.  I will try the concept and let you know how things turn out.

Thanks
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

cesemjAuthor Commented:
I receive Syntax Error (missing operator) in query expression 'SELECT ActivityDescription, Iif(IsNull([5_6AgeGroup], "", "X"), Iif(IsNull([7_10AgeGroup], "", "X"), Iif(IsNull([11_15AgeGroup], "", "X") FROM qryCT'

What do you think I did wrong.
0
Chuck WoodCommented:
Shouldn't you be using FROM tblDetail instead of qryCT?
0
cesemjAuthor Commented:
I receive the same error:
 I receive Syntax Error (missing operator) in query expression 'SELECT ActivityDescription, Iif(IsNull([5_6AgeGroup], "", "X"), Iif(IsNull([7_10AgeGroup], "", "X"), Iif(IsNull([11_15AgeGroup], "", "X") FROM qrytblDetalCrosstab'

Thanks
0
pteranodon72Commented:
Sorry, there -- missed some closing parentheses for IsNull.  Try:

SELECT ActivityDescription,
Iif(IsNull([5_6AgeGroup]), "", "X") AS [5_6Group],
Iif(IsNull([7_10AgeGroup]), "", "X") AS [7_10Group],
Iif(IsNull([11-15AgeGroup]), "", "X") AS [11-15Group]
FROM qrytblDetalCrosstab;


You may need to play with the exact text within [] to match your data -- I now see that there is an underscore in the first two groups but a hyphen in the third.  The paren problem was totally my fault, though.

pT
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cesemjAuthor Commented:
Thank you for helping me underatand.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.