473,748 Members | 4,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Desperately Seeking Help Filtering a Dynamic Crosstab Query Report

I tried to ask this question before on the 14th of January but I never got a
reply. I'm still struggling with the problem. I'll try to rephrase the
question:

I have a crosstab query with rows of students and columns of activities and
the data are the students' scores in each activity. No problem, almost.
The problem is that there are five classes at the moment and will be more
classes (or courses) in future semesters. I don't want all the classes to
show up on the same report. I can filter the query but the report won't
recognize the filtered query. I could post the entire code, but the filter
inside the report would look like this:

DoCmd.ApplyFilt er , "Me.courseC ode = '" &
Forms!frmSelect Course!cboSelec tCourse & "'"

or, in the filtered version of my query, my condition looks like this:

....WHERE
(((studentsInCo urses.courseCod e)=[Forms]![frmSelectCourse]![cboSelectCourse]
))

This WHERE condition works fine in the query but my report doesn't like it.
The report works fine in the unfiltered version of my query, but it shows
every class, thus creating empty columns.

In all the examples I've seen of dynamic crosstab query reports all over the
web I've never seen one that was filtered. Could it be that this type of
report just doesn't like filtering? Any ideas?

Many thanks in advance,

Rich Hollenbeck
Nov 13 '05 #1
15 4400
Crosstab queries like explicit parameters.
Open your query in design view, then click Query - Parameters.
In the dialog box that pops up, put
Forms!frmSelect Course!cboSelec tCourse
on the left side, and specify the data type on the right.

HTH

"Richard Hollenbeck" <ri************ ****@verizon.ne t> wrote in message
news:o5XTd.1805 0$uc.2699@trndd c09...
I tried to ask this question before on the 14th of January but I never got a reply. I'm still struggling with the problem. I'll try to rephrase the
question:

I have a crosstab query with rows of students and columns of activities and the data are the students' scores in each activity. No problem, almost.
The problem is that there are five classes at the moment and will be more
classes (or courses) in future semesters. I don't want all the classes to
show up on the same report. I can filter the query but the report won't
recognize the filtered query. I could post the entire code, but the filter inside the report would look like this:

DoCmd.ApplyFilt er , "Me.courseC ode = '" &
Forms!frmSelect Course!cboSelec tCourse & "'"

or, in the filtered version of my query, my condition looks like this:

...WHERE
(((studentsInCo urses.courseCod e)=[Forms]![frmSelectCourse]![cboSelectCourse] ))

This WHERE condition works fine in the query but my report doesn't like it. The report works fine in the unfiltered version of my query, but it shows
every class, thus creating empty columns.

In all the examples I've seen of dynamic crosstab query reports all over the web I've never seen one that was filtered. Could it be that this type of
report just doesn't like filtering? Any ideas?

Many thanks in advance,

Rich Hollenbeck

Nov 13 '05 #2
(replies moved to bottom-posting (see below))
"Richard Hollenbeck" <ri************ ****@verizon.ne t> wrote in message news:o5XTd.1805 0$uc.2699@trndd c09... (snip)
I have a crosstab query with rows of students and columns of activities and the data are the students' scores in each activity. (snip)I can filter the query but the report won't recognize the filtered query.
(snip)
WHERE (((studentsInCo urses.courseCod e)= _
[Forms]![frmSelectCourse]![cboSelectCourse] ))

(snip snip snip)
"MacDermott " <ma********@nos pam.com> wrote in message
news:iC******** *****@newsread3 .news.atl.earth link.net... Crosstab queries like explicit parameters.
Open your query in design view, then click Query - Parameters.
In the dialog box that pops up, put
Forms!frmSelect Course!cboSelec tCourse
on the left side, and specify the data type on the right.

HTH


Thanks. Yes, I already did that. As I said, the query works.
It's just when I try to use the query in a form that I get into
trouble. For example, I currently have 216 students in the
students table. But all those students aren't in the same class.
There are currently five classes over two semesters. When I
change the RecordSource of the report to the version of the query
which doesn't have the parameters, I get records for all 216
students. When I run that query as a query I get the same
answer. But when I run the query with the parameters as a query
on a selected course with, say 30 students in it, I get the
correct records for the currently selected class, 30. When I go
back to the report and change the RecordSource back to the query
WITH the parameters, the report will run, and it will recognize
that it has the correct number of fields, etc., but it will
produce zero, not 30 records for the same selected class. The
only difference between the two version of this query is one has
parameters and the other doesn't. Should I post my query and the
report's code?

Thanks.

Rich Hollenbeck

Nov 13 '05 #3
Sure, post the SQL for the query.

BTW, is the form open when you run the report?
"Richard Hollenbeck" <ri************ ****@verizon.ne t> wrote in message
news:xe0Ud.5625 3$uc.11359@trnd dc04...
(replies moved to bottom-posting (see below))
"Richard Hollenbeck" <ri************ ****@verizon.ne t> wrote in

message
news:o5XTd.1805 0$uc.2699@trndd c09...

(snip)
I have a crosstab query with rows of students and columns of activities and the data are the students' scores in each activity. (snip)I can filter the query but the report won't recognize the filtered query.
(snip)
WHERE (((studentsInCo urses.courseCod e)= _
[Forms]![frmSelectCourse]![cboSelectCourse] ))

(snip snip snip)
"MacDermott " <ma********@nos pam.com> wrote in message
news:iC******** *****@newsread3 .news.atl.earth link.net...
Crosstab queries like explicit parameters.
Open your query in design view, then click Query - Parameters.
In the dialog box that pops up, put
Forms!frmSelect Course!cboSelec tCourse
on the left side, and specify the data type on the right.

HTH


Thanks. Yes, I already did that. As I said, the query works.
It's just when I try to use the query in a form that I get into
trouble. For example, I currently have 216 students in the
students table. But all those students aren't in the same class.
There are currently five classes over two semesters. When I
change the RecordSource of the report to the version of the query
which doesn't have the parameters, I get records for all 216
students. When I run that query as a query I get the same
answer. But when I run the query with the parameters as a query
on a selected course with, say 30 students in it, I get the
correct records for the currently selected class, 30. When I go
back to the report and change the RecordSource back to the query
WITH the parameters, the report will run, and it will recognize
that it has the correct number of fields, etc., but it will
produce zero, not 30 records for the same selected class. The
only difference between the two version of this query is one has
parameters and the other doesn't. Should I post my query and the
report's code?

Thanks.

Rich Hollenbeck

Nov 13 '05 #4
(replies moved to bottom-posting (I just read a big lecture about
bottom posting))

:-) (see below)
"Richard Hollenbeck" <ri************ ****@verizon.ne t> wrote in message news:xe0Ud.5625 3$uc.11359@trnd dc04...
(replies moved to bottom-posting (see below))
"Richard Hollenbeck" <ri************ ****@verizon.ne t> wrote in
message
news:o5XTd.1805 0$uc.2699@trndd c09... (snip)
> I have a crosstab query with rows of students and columns
of activities
> and the data are the students' scores in each activity.

(snip)
>I can filter the query but the report won't recognize the

filtered query.
(snip)
> WHERE (((studentsInCo urses.courseCod e)= _
>[Forms]![frmSelectCourse]![cboSelectCourse] ))

(snip snip snip)
"MacDermott " <ma********@nos pam.com> wrote in message
news:iC******** *****@newsread3 .news.atl.earth link.net...
Crosstab queries like explicit parameters...
(snip) HTH


Thanks. Yes, I already did that. As I said, the query

works. It's just when I try to use the query in a form that I get into trouble. For example, I currently have 216 students in the
students table. But all those students aren't in the same class. There are currently five classes over two semesters. When I
change the RecordSource of the report to the version of the query which doesn't have the parameters, I get records for all 216
students. When I run that query as a query I get the same
answer. But when I run the query with the parameters as a query on a selected course with, say 30 students in it, I get the
correct records for the currently selected class, 30. When I go back to the report and change the RecordSource back to the query WITH the parameters, the report will run, and it will recognize that it has the correct number of fields, etc., but it will
produce zero, not 30 records for the same selected class. The only difference between the two version of this query is one has parameters and the other doesn't. Should I post my query and the report's code?

Thanks.

Rich Hollenbeck


"MacDermott " <ma********@nos pam.com> wrote in message
news:Np******** ********@newsre ad2.news.atl.ea rthlink.net... Sure, post the SQL for the query.

BTW, is the form open when you run the report?

Yes, frmSelectCourse is always open. It's like a switchboard
that gets the ball rolling. The teacher cannot enter or view
grades unless he or she first selects a course. That way I can
have Access always refer to this combo box containing the course
code. When this form closes, the application exits. Here's my
SQL for this query. The query is called qryTableOfGrade s:

PARAMETERS [Forms]![frmSelectCourse]![cboSelectCourse] Text (
255 );
TRANSFORM Sum(studentScor es.score) AS SumOfscore
SELECT studentsInCours es.courseCode, courses.courseD escription,
[lName] & ", " & [fName] & " " & [StudentNumber] AS Student
FROM students INNER JOIN (((courses INNER JOIN groups ON
courses.courseC ode = groups.courseCo de) INNER JOIN
studentsInCours es ON courses.courseC ode =
studentsInCours es.courseCode) INNER JOIN (activities INNER JOIN
studentScores ON activities.acti vityID =
studentScores.a ctivityID) ON groups.groupID = activities.grou pID)
ON (students.stude ntID = studentsInCours es.studentID) AND
(students.stude ntID = studentScores.s tudentID)
WHERE
(((studentsInCo urses.courseCod e)=[Forms]![frmSelectCourse]![cboSe
lectCourse]))
GROUP BY studentsInCours es.courseCode, courses.courseD escription,
[lName] & ", " & [fName] & " " & [StudentNumber]
ORDER BY studentsInCours es.courseCode
PIVOT activities.acti vityDescription ;

Thanks.
Nov 13 '05 #5
Bri
Richard,

You don't have to be so anal about bottom posting. If the guy that is
trying to help you prefers to top post, then let him, don't go moving
his stuff around.

Also, if you are going to bottom post the be sure to SNIP the previous
message to just what it pertinent to your post. Otherwise, its a huge
scroll down to get to where the new stuff is. This is a particular pain
for those that read this through Google where when a message is too
long, you have to go to another link to see the bottom post.

--
Bri
Richard Hollenbeck wrote:
(replies moved to bottom-posting (I just read a big lecture about
bottom posting))

:-) (see below)


Nov 13 '05 #6
So -
you say the query runs directly from the database window correctly?
But the report based on that same query returns no records?
How are you invoking the report?
Directly from the database window?
Through code from your interface?
If this latter, please post the code that calls the report.
"Richard Hollenbeck" <ri************ ****@verizon.ne t> wrote in message
news:0%fUd.6328 8$wc.59202@trnd dc07...
(replies moved to bottom-posting (I just read a big lecture about
bottom posting))

:-) (see below)
"Richard Hollenbeck" <ri************ ****@verizon.ne t> wrote in

message
news:xe0Ud.5625 3$uc.11359@trnd dc04...
(replies moved to bottom-posting (see below))

> "Richard Hollenbeck" <ri************ ****@verizon.ne t> wrote in message
> news:o5XTd.1805 0$uc.2699@trndd c09...
(snip)
> > I have a crosstab query with rows of students and columns of activities
> > and the data are the students' scores in each activity.
(snip)
>>I can filter the query but the report won't recognize the
filtered query.
(snip)

> > WHERE (((studentsInCo urses.courseCod e)= _
>>[Forms]![frmSelectCourse]![cboSelectCourse] ))
(snip snip snip)
"MacDermott " <ma********@nos pam.com> wrote in message
news:iC******** *****@newsread3 .news.atl.earth link.net...
> Crosstab queries like explicit parameters... (snip) > HTH

Thanks. Yes, I already did that. As I said, the query works. It's just when I try to use the query in a form that I get into trouble. For example, I currently have 216 students in the
students table. But all those students aren't in the same class. There are currently five classes over two semesters. When I
change the RecordSource of the report to the version of the query which doesn't have the parameters, I get records for all 216
students. When I run that query as a query I get the same
answer. But when I run the query with the parameters as a query on a selected course with, say 30 students in it, I get the
correct records for the currently selected class, 30. When I go back to the report and change the RecordSource back to the query WITH the parameters, the report will run, and it will recognize that it has the correct number of fields, etc., but it will
produce zero, not 30 records for the same selected class. The only difference between the two version of this query is one has parameters and the other doesn't. Should I post my query and the report's code?

Thanks.

Rich Hollenbeck


"MacDermott " <ma********@nos pam.com> wrote in message
news:Np******** ********@newsre ad2.news.atl.ea rthlink.net...
Sure, post the SQL for the query.

BTW, is the form open when you run the report?

Yes, frmSelectCourse is always open. It's like a switchboard
that gets the ball rolling. The teacher cannot enter or view
grades unless he or she first selects a course. That way I can
have Access always refer to this combo box containing the course
code. When this form closes, the application exits. Here's my
SQL for this query. The query is called qryTableOfGrade s:

PARAMETERS [Forms]![frmSelectCourse]![cboSelectCourse] Text (
255 );
TRANSFORM Sum(studentScor es.score) AS SumOfscore
SELECT studentsInCours es.courseCode, courses.courseD escription,
[lName] & ", " & [fName] & " " & [StudentNumber] AS Student
FROM students INNER JOIN (((courses INNER JOIN groups ON
courses.courseC ode = groups.courseCo de) INNER JOIN
studentsInCours es ON courses.courseC ode =
studentsInCours es.courseCode) INNER JOIN (activities INNER JOIN
studentScores ON activities.acti vityID =
studentScores.a ctivityID) ON groups.groupID = activities.grou pID)
ON (students.stude ntID = studentsInCours es.studentID) AND
(students.stude ntID = studentScores.s tudentID)
WHERE
(((studentsInCo urses.courseCod e)=[Forms]![frmSelectCourse]![cboSe
lectCourse]))
GROUP BY studentsInCours es.courseCode, courses.courseD escription,
[lName] & ", " & [fName] & " " & [StudentNumber]
ORDER BY studentsInCours es.courseCode
PIVOT activities.acti vityDescription ;

Thanks.

Nov 13 '05 #7
Thanks, MacDermott, for your help. I'm sorry about moving your
posts to the bottom. I didn't mean to be anal, as somebody just
suggested, but I had recently been severely flamed about top
posting and I was attempting to correct the error of my ways.

You are exactly correct. The query runs correctly from the
database window, but when I make this query the recordsource of
the report, it returns no records. The main way I invoke this
report is by a menu item, which directly opens the report without
any filtering. Even when I open the report from the database
window there is no difference. I'm now getting an error that
says "Too few parameters. Expected 1."
Nov 13 '05 #8
Bri,

Your point is well taken. Thank you. I'm still learning about
this stuff and I seem to get in trouble no matter what I do. I
can see that changing somebody's message around can be
offensive--especially when he's only trying to help me. I
recently began thinking about top and bottom posting issues and
I'm not yet set in my ways. I don't mean to be anal about it.
Please forgive my ignorance.

Rich Hollenbeck

"Bri" <no*@here.com > wrote in message
news:VSnUd.5188 05$Xk.120726@pd 7tw3no...
Richard,

You don't have to be so anal about bottom posting. If the guy that is trying to help you prefers to top post, then let him, don't go moving his stuff around.

Also, if you are going to bottom post the be sure to SNIP the previous message to just what it pertinent to your post. Otherwise, its a huge scroll down to get to where the new stuff is. This is a particular pain for those that read this through Google where when a message is too long, you have to go to another link to see the bottom post.

--
Bri
Richard Hollenbeck wrote:
(replies moved to bottom-posting (I just read a big lecture about bottom posting))

:-) (see below)

Nov 13 '05 #9
Bri
Richard,

No offense taken or intended. Just feedback to help you.

I don't understand why people get so wound up about the top/bottom
posting issue, but they do. There are pluses and minuses to both
methods. I just thought that I would point out that what you were doing
was sort of 'biting the hand that feeds you'. Also that if you are going
to bottom post, make sure that the quoted material above your post is
small enough that people will be able to find your bottom post.

--
Bri

Richard Hollenbeck wrote:
Bri,

Your point is well taken. Thank you. I'm still learning about
this stuff and I seem to get in trouble no matter what I do. I
can see that changing somebody's message around can be
offensive--especially when he's only trying to help me. I
recently began thinking about top and bottom posting issues and
I'm not yet set in my ways. I don't mean to be anal about it.
Please forgive my ignorance.

Rich Hollenbeck


Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
17670
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to Create a Dynamic Crosstab Report PRODUCT :Microsoft Access PROD/VER:1.00 1.10 OPER/SYS:WINDOWS
1
3336
by: Richard Hollenbeck | last post by:
Hello Newsgroup. You have all been very helpful in the past and I thank you. I try to ask relevant questions so that they don't just benefit me, but also benefit the group. I'm currently overwhelmed by useless examples across the web on how to make "dynamic crosstab reports" without myself having a basic understanding about how to retrieve and assign recordsources, etc., from fields in a query to fields in the report. I see all these...
0
1675
by: Richard Hollenbeck | last post by:
I have a crosstab query that shows all the scores of all the activities of all the students in all courses, with the students being in the rows and the activities being in the columns and the scores being in the intersections of the rows and columns. I also have a report based on this query that, depending on the activity names, will dynamically insert the field names into the column labels, so that I don't have to make a new report...
3
3597
by: deejayquai | last post by:
Hi I've created a crosstab query and displayed it as a sub-report in my main report. This is fine until the data changes and the column names become incorrect. I know I have to create a 'dynamic crosstab query' but I don't know how to!! I've read the "How to..." on the Microsoft site but it mainly gives an example rather than explain the basics, which I can't work out. My context is:
2
2940
by: deejayquai | last post by:
Hi I'm trying to produce a report based on a dynamic crosstab. Ultimately i'd like the report to actually become a sub report within a student end of year record of achievement. The dynamic sub-report will capture what grades the student has achieved in a list of different subjects and the reason I need it to be dynamic is that students take different subjects. Basically I've been trying to doctor the KB article on dynamic
1
5163
by: Brad | last post by:
Thanks for taking the time to read my question. I have a table of data that has Date, Data and Category. I need to show, in a report, each Categories Data by Date. The Date has to be it's own column across the top and Category down the left side. As data is entered, the number of unique dates increases. As a result the
13
17167
by: salad | last post by:
Operating in A97. I didn't receive much of a response conserning Pivot tables in Access. Pivot tables are nice, but a CrossTab will work for me too. Using a Pivot table, one is actually launching Excel for data viewing. I'd prefer the user stay in Access. Creating dynamic crosstab queries is pretty simple. The problem is that the column count may shrink or grow depending on the filter.
0
2323
by: Peter Herath | last post by:
I want to create a custormizable report . For an example, there's a form with four combo boxes and two of them having database tables columns/field names as values in the combo box(one for select row filed and other one for select column filed in the report) when u select items in that combo boxes and press a Button then selected items should go to the crosstab query as parameters and execute the query. upto that i have done my coding part but...
14
7856
ollyb303
by: ollyb303 | last post by:
Hi, I am trying to create a dynamic crosstab report which will display number of calls handled (I work for a call centre) per day grouped by supervisor. I have one crosstab query (Query1) which has the following fields: SPID (supervisor ID), total:group by, as row heading Date, total:group by, as column heading Calls handled, total:sum, as value Date, total:where, criteria between and - this is taken from a form,
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9544
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8243
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4606
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.