Solved

Not valid field error when using crosstab query as record source for report

Posted on 2008-06-12
4
216 Views
Last Modified: 2013-11-28
I created a report using a crosstab query as the source.  Everything works fine as long as the criteria the user selects includes data for all the columns.  What do you do if it doesn't?  How do I get around the error and just leave that column blank?
Thanks in advance.
0
Comment
Question by:BobRosas
[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

Accepted Solution

by:
peter57r earned 125 total points
ID: 21771539
You can't base a standard report on a dynamic crosstab (where the columns are not known in advance).
Either you have to fix the crosstab column headings by using the Columns property, or you have to build the report in code based on the actual columns found.
0
 
LVL 34

Assisted Solution

by:Mike Eghtebas
Mike Eghtebas earned 125 total points
ID: 21771583
Try using alias name for your fields like

SumVal: Sum(Budget)

as opposed to

Sum(Budget)            ' query will give the name SumOfBudget

Otherwise. you might have [Budget] in the control source of a text box but it expects SumOfBudget

But if you use alias name, you already know the field name and will put SumVal in the control source of the text box.

Mike
0
 

Author Comment

by:BobRosas
ID: 21772483
Thank you both for your quick responses.  I'm trying to assign column headings to see if I can get that to work but I can't even get the assigned names to work.  If I run CodeA below I get all the data I expected(the 6 columns have data for each column).  If I run CodeB, the headings show but I don't have any data under any of the 6 headings.  Any thoughts!
Thanks so much!


CodeA
TRANSFORM Count(tblMTRptAge.AgeCount) AS CountOfAgeCount
SELECT tblMTRptAge.County, tblMTRptAge.ServiceLkUpID, Sum(tblMTRptAge.Age) AS SumOfAge
FROM tblMTRptAge
GROUP BY tblMTRptAge.County, tblMTRptAge.ServiceLkUpID
PIVOT tblMTRptAge.AgeGrp;

CodeB
TRANSFORM Count(tblMTRptAge.AgeCount) AS CountOfAgeCount
SELECT tblMTRptAge.County, tblMTRptAge.ServiceLkUpID, Sum(tblMTRptAge.Age) AS SumOfAge
FROM tblMTRptAge
GROUP BY tblMTRptAge.County, tblMTRptAge.ServiceLkUpID
PIVOT tblMTRptAge.AgeGrp In ("To16","To24","To34","To44","To54","Over54");
0
 

Author Comment

by:BobRosas
ID: 21772741
Disregard above.  I thought I could name the columns anything I wanted but as soon as I named the columns to match the field names the data showed.  The report seems to be working now.  I couldn't have done it without you guys.  Thanks you both for your help.  
0

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

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…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

628 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