?
Solved

Crosstab query problem

Posted on 2008-10-14
4
Medium Priority
?
218 Views
Last Modified: 2013-11-29
I get an error when I try to open a report which is based on a crosstab query.  The error is due a missing field the crosstab after it is run on a certian set of data.  The report has fixed fields which display the count of records which contain a certain value in a table.  Is there some way that I can make the crosstab query display certain value feilds even if the table/query that the data comes from is not present.  Also I have tried IIF statements in the report to ignore the missing feild and display 0 but this did not work.  

Any ideas?  

The report works fine if the feild is present in the crosstab query.

0
Comment
Question by:randyone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 22718343
You can set fixed field names in the Columns property of the query - you must match exactly the spelling in the data.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22719752
randyone,


Try Pete's suggestion first.


Some common things you can try, depednding on how your data is structured.

- Do not use fixed Fields in the report, simply insert the crosstab query as a sub report.
- Create a table with all of the fields and use a Join to display all the fields (even if they are missing)

JeffCoachman
0
 

Accepted Solution

by:
randyone earned 0 total points
ID: 22725353
Thanks guys for the suggestions, but I after digging that that I can add a IN option after the PIVOT statement in SQL which fixes the feilds.  I ended up with something like this:

PIVOT queNetRecordsAll.block_code In(0,4,5);

Worked perfectly!

Thanks again,

Randy
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22727075
Congratulations!
;-)
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question