473,386 Members | 1,819 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,386 software developers and data experts.

Report, Crosstab Query and Parameters

I've been looking over this newsgroup, but I can't find an answer to my
problem. I see that a few others have posted this issue over the
years, but none of them got a response. I'll give it another shot.

I have a report that is based on a crosstab query. The crosstab query
is based off of another query, and that has a parameter in the where
clause. Like this:

WHERE e.elevationid = [Forms]![ElevationSelect]![elevationcode]

If I run the sub-query alone, it prompts me for the parameter, then
runs fine.

If I run the crosstab query, it prompts me for the parameter, then runs
fine.

If I run the report, it shows me the form, lets me enter in the data
for the parameter, then gives me an error saying:

(-2147217904) No value given for one or more required parameters.

I don't get it. If I use a normal query for the report rather than a
crosstab, it works fine. When I switch to the crosstab query, kaboom.

Can anyone help?!? Thanks in advance...

- Bryan

Nov 13 '05 #1
3 3394
Bryan wrote:
I've been looking over this newsgroup, but I can't find an answer to
my problem. I see that a few others have posted this issue over the
years, but none of them got a response. I'll give it another shot.

I have a report that is based on a crosstab query. The crosstab query
is based off of another query, and that has a parameter in the where
clause. Like this:

WHERE e.elevationid = [Forms]![ElevationSelect]![elevationcode]

If I run the sub-query alone, it prompts me for the parameter, then
runs fine.

If I run the crosstab query, it prompts me for the parameter, then
runs fine.

If I run the report, it shows me the form, lets me enter in the data
for the parameter, then gives me an error saying:

(-2147217904) No value given for one or more required parameters.

I don't get it. If I use a normal query for the report rather than a
crosstab, it works fine. When I switch to the crosstab query, kaboom.

Can anyone help?!? Thanks in advance...


Not sure I've seen that exact symptom, but crosstabs insist that all
parameters be explicitly defined in the parameters dialog when in query
design view whereas other query types will usually evaluate parameters
on-the-fly. This includes parameters that are coming from queries providing
input to the crosstab.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #2
Rick - thanks for the reply.

I do have the parameters defined in the Crosstab query.

I've found a bit more info since my original post.

The report for this query has a number of unbound fields where the data
will eventually end up. I'm doing this to account for some queries
having more columns than others. Based on the example in the Access
Developer's Handbook by Getz, Litwin & Gilbert, I use this code in the
Report_Open function to map the query to the unbound fields:
Set oRst = New ADODB.Recordset
oRst.ActiveConnection = CurrentProject.Connection

oRst.Open Me.RecordSource, CurrentProject.Connection, , , adCmdTable

iCtlCount = Me.Detail.Controls.count - 3
iFldCount = oRst.Fields.count

For iLoop = 1 To iFldCount - 3
sName = oRst.Fields(iLoop + 2).name
Me.Controls("col" & iLoop).ControlSource = sName
Next
The error occurs on the oRst.Open statement. The question is, how do I
sent the parameters to that query????

Nov 13 '05 #3
Okay, I figured it out. For anyone who may try to do this in the
future, here's what I did:

Instead of the oRst.Open I was doing before, I changed it to this:
Dim oRst As adodb.Recordset
Dim oCmd As adodb.Command

Set oCmd.ActiveConnection = CurrentProject.Connection

With oCmd
.CommandText = Me.RecordSource
.CommandType = adCmdStoredProc
.Parameters.Append
..CreateParameter("[Forms]![ElevationSelect]![elevationcode]",
adInteger, adParamInput, , Forms(frmElevationForm)("elevationcode"))
End With

Set oRst = oCmd.Execute
Works like a charm!

Nov 13 '05 #4

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

Similar topics

8
by: Donna Sabol | last post by:
First, I should start by saying I am creating a database to be used by some very impatient, non-computer literate people. It needs to be seameless in it's operation from their point of view. I...
1
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...
3
by: Edward | last post by:
ACCESS 2k I need to design a report based on a rota system for staff at various shops. The data is effectively stored in a single table, along the lines of: Initials (e.g. BH, FG, RM etc.)...
0
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...
15
by: Richard Hollenbeck | last post by:
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...
1
by: mtech1 | last post by:
Access 2002 I am trying to create a dynamic crosstab report that parameters come from 3 different forms. I get runtime error 3070 - The Microsoft Jet database engine does not recognize...
1
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...
6
by: Peter Herath | last post by:
I want to create a dynamic report using a crosstab query...... pls someone look into my attached example database and help me out to do the report generation.... example is like dis...: there...
14
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...

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.