473,417 Members | 1,566 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,417 software developers and data experts.

How to use a saved cross-tab query in a report?

I am very sorry about the (almost) re-post, but you will see that my first
question wasn't very clear; I have another question I posted this morning
called, "in DAO: Run time error 3061 Too few parameters...."

I have read many articles on the web about how to make a dynamic report
based on a cross-tab query. But for some reason mine never works right.

First, my saved query's criteria is the data in an open form's combo box.
So the resulting data is limited to about 30-45 records out of several
thousand records. The "parameters" data is properly filled in at the saved
query and it matches the criteria in the design view. When running the
query by itself it correctly limits the records to match the data in that
aforementioned combo box. So far, so good.

Now I try to build my report based on this query. It should look kind of
like a spreadsheet but it will span a few pages deep and a few pages wide,
depending on how many fields are generated and how many records are pulled.
I have no way of knowing either the number of records or fields at this
time. It will depend on many things. Sorry I'm being cryptic, but it is
that it is a grades program with varying number of students and varying
number of assignments.

So my saved query is called qryTableOfGrades.

I will want to cycle through all the fields in the query to assign field
names to the columns in the report, as is typically shown on many web sites.
I start by setting up a DAO database:

*-*-*

Dim rs As DAO.RecordSet
Dim db As DAO.Database

Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM qryTableOfGrades;")

*-*-*

Should work right? Nope! "Run-time error '3061': Too few parameters.
Expected 0."

Should I take off the parameters in the saved query and put the parameters
into the report instead with a WHERE clause?

This is a very old question. I asked about six months ago and never got an
answer that worked.

Maybe something obvious is wrong but it isn't obvious to me. I'm missing it
completely.

Can I send somebody a copy of my program zipped? This is a live program
with real students so I will have to make a copy and delete students in the
copy to protect their privacy and I'll add dummy names llike Fred Flintstone
instead.


Jun 10 '07 #1
3 2047
On Jun 10, 8:29 pm, "Richard Hollenbeck"
<richard.hollenb...@verizon.netwrote:
I am very sorry about the (almost) re-post, but you will see that my first
question wasn't very clear; I have another question I posted this morning
called, "in DAO: Run time error 3061 Too few parameters...."

I have read many articles on the web about how to make a dynamic report
based on a cross-tab query. But for some reason mine never works right.

First, my saved query's criteria is the data in an open form's combo box.
So the resulting data is limited to about 30-45 records out of several
thousand records. The "parameters" data is properly filled in at the saved
query and it matches the criteria in the design view. When running the
query by itself it correctly limits the records to match the data in that
aforementioned combo box. So far, so good.

Now I try to build my report based on this query. It should look kind of
like a spreadsheet but it will span a few pages deep and a few pages wide,
depending on how many fields are generated and how many records are pulled.
I have no way of knowing either the number of records or fields at this
time. It will depend on many things. Sorry I'm being cryptic, but it is
that it is a grades program with varying number of students and varying
number of assignments.

So my saved query is called qryTableOfGrades.

I will want to cycle through all the fields in the query to assign field
names to the columns in the report, as is typically shown on many web sites.
I start by setting up a DAO database:

*-*-*

Dim rs As DAO.RecordSet
Dim db As DAO.Database

Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM qryTableOfGrades;")

*-*-*

Should work right? Nope! "Run-time error '3061': Too few parameters.
Expected 0."

Should I take off the parameters in the saved query and put the parameters
into the report instead with a WHERE clause?

This is a very old question. I asked about six months ago and never got an
answer that worked.

Maybe something obvious is wrong but it isn't obvious to me. I'm missing it
completely.

Can I send somebody a copy of my program zipped? This is a live program
with real students so I will have to make a copy and delete students in the
copy to protect their privacy and I'll add dummy names llike Fred Flintstone
instead.
Hi,
just some hints that may help!

- Declare parameters in your query: while in design view, query >
parameters copy&paste from the query grade, e.g. [Form]![FormName]!
[comboBox], with appropriate data type;

- in DAO, supply an argument for each parameter:

Dim qdf As QueryDef
....
Set qdf = db.QueryDefs("qryTableOfGrades")
With qdf
.Parameters("[Form]![FormName]![comboBox]") = [Form]!
[FormName]![comboBox] ' odd ;-)
...
End With
Set rs = qdf.OpenRecordset
' now your recordset should be ok.
for each field in rs.fields
....

Set qdf = Nothing
Set rs = Nothing
...

HTH
spier

Jun 11 '07 #2
Many thanks to you (and to Allen Browne who answered my original post). I
don't have time this morning to try your examples but I will take my Access
Developer's Handbook to work with me this morning to study QueryDefs. Then
I will study both of your replies again and try it.

I will post the results.

Rich

"spier" <sp*****@yahoo.comwrote in message
news:11*********************@c77g2000hse.googlegro ups.com...
On Jun 10, 8:29 pm, "Richard Hollenbeck"
<richard.hollenb...@verizon.netwrote:
>I am very sorry about the (almost) re-post, but you will see that my
first
question wasn't very clear; I have another question I posted this morning
called, "in DAO: Run time error 3061 Too few parameters...."

I have read many articles on the web about how to make a dynamic report
based on a cross-tab query. But for some reason mine never works right.

First, my saved query's criteria is the data in an open form's combo
box.
So the resulting data is limited to about 30-45 records out of several
thousand records. The "parameters" data is properly filled in at the
saved
query and it matches the criteria in the design view. When running the
query by itself it correctly limits the records to match the data in that
aforementioned combo box. So far, so good.

Now I try to build my report based on this query. It should look kind of
like a spreadsheet but it will span a few pages deep and a few pages
wide,
depending on how many fields are generated and how many records are
pulled.
I have no way of knowing either the number of records or fields at this
time. It will depend on many things. Sorry I'm being cryptic, but it is
that it is a grades program with varying number of students and varying
number of assignments.

So my saved query is called qryTableOfGrades.

I will want to cycle through all the fields in the query to assign field
names to the columns in the report, as is typically shown on many web
sites.
I start by setting up a DAO database:

*-*-*

Dim rs As DAO.RecordSet
Dim db As DAO.Database

Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM qryTableOfGrades;")

*-*-*

Should work right? Nope! "Run-time error '3061': Too few parameters.
Expected 0."

Should I take off the parameters in the saved query and put the
parameters
into the report instead with a WHERE clause?

This is a very old question. I asked about six months ago and never got
an
answer that worked.

Maybe something obvious is wrong but it isn't obvious to me. I'm missing
it
completely.

Can I send somebody a copy of my program zipped? This is a live program
with real students so I will have to make a copy and delete students in
the
copy to protect their privacy and I'll add dummy names llike Fred
Flintstone
instead.

Hi,
just some hints that may help!

- Declare parameters in your query: while in design view, query >
parameters copy&paste from the query grade, e.g. [Form]![FormName]!
[comboBox], with appropriate data type;

- in DAO, supply an argument for each parameter:

Dim qdf As QueryDef
...
Set qdf = db.QueryDefs("qryTableOfGrades")
With qdf
.Parameters("[Form]![FormName]![comboBox]") = [Form]!
[FormName]![comboBox] ' odd ;-)
...
End With
Set rs = qdf.OpenRecordset
' now your recordset should be ok.
for each field in rs.fields
...

Set qdf = Nothing
Set rs = Nothing
...

HTH
spier

Jun 11 '07 #3
Hi,
just some hints that may help!

- Declare parameters in your query: while in design view, query >
parameters copy&paste from the query grade, e.g. [Form]![FormName]!
[comboBox], with appropriate data type;

- in DAO, supply an argument for each parameter:

Dim qdf As QueryDef
...
Set qdf = db.QueryDefs("qryTableOfGrades")
With qdf
.Parameters("[Form]![FormName]![comboBox]") = [Form]!
[FormName]![comboBox] ' odd ;-)
...
End With
Set rs = qdf.OpenRecordset
' now your recordset should be ok.
for each field in rs.fields
...

Set qdf = Nothing
Set rs = Nothing
...

HTH
spier
Thanks. The following seems to be working:
*-*-*
Set db = CurrentDb
Set qdf = db.QueryDefs("qryTableOfGrades")

With qdf
.Parameters("[Forms]!frmSelectCourse]![cboSelectCourse") =
[Forms]![frmSelectCourse]![cboSelectCourse]
End With

Set rs = qdf.OpenRecordset()
*-*-*

I don't know why it is working but it does cycle through the records.

Now for my next question. . . (in a new post.)
Jun 13 '07 #4

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

Similar topics

12
by: * ProteanThread * | last post by:
but depends upon the clique: ...
3
by: Tom | last post by:
Say a form has a subform, a button that pops up a message box and a cancel button. Q1. If data is entered in one or more fields on the main form and the user then clicks the button that opens the...
23
by: Jeff Rodriguez | last post by:
Here's what I want do: Have a main daemon which starts up several threads in a Boss-Queue structure. From those threads, I want them all to sit and watch a queue. Once an entry goes into the...
7
by: Scott M. | last post by:
How can I disable the cross-site scripting check for one particular page of a site?
8
by: Pieter | last post by:
Hi, I'm having some weird problem using the BackGroundWorker in an Outlook (2003) Add-In, with VB.NET 2005: I'm using the BackGroundWorker to get the info of some mailitems, and after each item...
3
by: jlamanna | last post by:
I was wondering if there was a utility that could tell you when your C# application is making cross-apartment COM calls. I have a fairly large application that makes extensive use of a 3rd party...
15
by: Sharon | last post by:
I have an XML question: I'm have an XML node of type PointF and when it's saved to a file by XmlDocument.Save(...) it saves as I expect it to be saved: <ImageOrigin>{X=1.2,...
6
by: Simon | last post by:
Hi All, An experiment i'm doing requires requires a synchronous cross-domain request, without using a proxy. I wondered if anyone had any ideas to help me achieve this. Below is what I have...
6
by: Bart Van der Donck | last post by:
Hello, I'm presenting my new library 'AJAX Cross Domain' - a javascript extension that allows to perform cross-domain AJAX requests. http://www.ajax-cross-domain.com/ Any comments or...
6
by: ampo | last post by:
Hello. Can anyone help with cross-domain problem? I have HTML page from server1 that send xmlHTTPRequest to server2. How can I do it? Thanks.
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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...
0
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...

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.