Solved

Crosstab query problem

Posted on 2008-10-14
4
216 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

690 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