Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-06-12
4
Medium Priority
?
219 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 500 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 500 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

670 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