473,396 Members | 2,013 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,396 software developers and data experts.

Crosstab query

I'm using Access 2003 and was wondering if it is possible to have a
paramater selection within a crosstab query so that I wouldn't need to build
a new table.

I have a select query that I'm using to build the crosstab query from. In
the select query I'm prompting for a specific quarter but when I go to run
the crosstab it doesn't seem to like the parameter that has been put on the
select query and returns a message of "The Microsoft Jet database engine
does not recognize '[Which Period?]' as a valid field name or expression."

Any suggestions would be greatly appreciated.
Nov 13 '05 #1
4 8076
On Tue, 26 Apr 2005, "Judy" <ju*********@nortel.com> wrote:
I have a select query that I'm using to build the crosstab query from. In
the select query I'm prompting for a specific quarter but when I go to run
the crosstab it doesn't seem to like the parameter that has been put on the
select query and returns a message of "The Microsoft Jet database engine
does not recognize '[Which Period?]' as a valid field name or expression."


When I need any kind of query with user input, I base the query
on an entry box on a form, and point the query criteria line to
the box on the form, such as

[forms]![PrinterForm]![EnterName]

If you are already doing that... ignore this
John Thomas Smith
http://www.direct2usales.com
http://www.pacifier.com/~jtsmith
Nov 13 '05 #2
Crosstab queries in Access are temperamental that way. The fix is to
move your parameter from the underlying query to the crosstab query.
You can place a parameter in any of the RowHeading fields for the
crosstab query.

Right-click in the body of the query next to the table listing. From
the dropdown menu select Parameters. This will give you a grid where
you enter your parameter. Give your parameter a name and select the
datatype (text, number, date). Then in the Rowheading field where you
want to use this parameter you write this in the Criteria section under
that column

[Name]

Put the name of your parameter that you entered in the grid in the
criteria section of the RowHeading column you want to filter, and you
have to surround this with left and right square brackets [ ].

Another way to set a parameter in a query (crosstab query) is to write a
function in a standard module (click on Modules in the database window
to get to a standard module). This is useful if you have a vba routine
which needs to pass a parameter to a crosstab query. Interestingly, I
have not be able to pass params to crosstab queries using DAO. But the
function method works fine. In the module your write a simple function
like this

Function GetName() As String
GetName = strName
End Function

strName would be a global string variable. You set its value in code
and then access your crosstab query. You could do something simple like
this to set the value of your function - this value will live until you
close your session of Access down.

Sub setValue()
GetName = "Bill"
End Sub

In the crosstab query you would have entered the function name in the
criteria section of the RowHeading Column you want to filter. ...Like
this... setValue()

You have to include the Parentheses. Now open your query. If you have
rows that contain the value "Bill", this will show up in your crosstab
query.
Rich

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #3
Judy,
This worked on a database I use to track the money I spend:
PARAMETERS [Which Year?] Short;
TRANSFORM NZ(Sum(HOURS_FACT_TBL.EST_NET_PAY),0) AS TOTAL_EST_NET_PAY
SELECT PROJECT_LKP.NAME AS PROJECT, NZ(Sum(HOURS_FACT_TBL.EST_NET_PAY),0) AS
TOTAL_EST_NET_PAY1
FROM (HOURS_FACT_TBL INNER JOIN SS_DATE_TBL ON HOURS_FACT_TBL.DATE_WORKED =
SS_DATE_TBL.DATE) INNER JOIN PROJECT_LKP ON HOURS_FACT_TBL.PROJECT =
PROJECT_LKP.ID
WHERE (((SS_DATE_TBL.YEAR)=[Which Year?]))
GROUP BY PROJECT_LKP.NAME
PIVOT SS_DATE_TBL.GCAL_QTR_TEXT In ("Q1","Q2","Q3","Q4");

If I changed the spelling of [Which Year?] in any way in either of the two
places where it is used Jet will kick the error you talked about.
--
Alan Webb
kn*******@SPAMhotmail.com
"It's not IT, it's IS"

"Judy" <ju*********@nortel.com> wrote in message
news:d4**********@zcars129.ca.nortel.com...
I'm using Access 2003 and was wondering if it is possible to have a
paramater selection within a crosstab query so that I wouldn't need to
build
a new table.

I have a select query that I'm using to build the crosstab query from. In
the select query I'm prompting for a specific quarter but when I go to run
the crosstab it doesn't seem to like the parameter that has been put on
the
select query and returns a message of "The Microsoft Jet database engine
does not recognize '[Which Period?]' as a valid field name or expression."

Any suggestions would be greatly appreciated.

Nov 13 '05 #4
another suggestion is to wrap your criteria in Eval("")..... thus
Eval("[Which Period?]"). as mentioned above, crosstab queries are
temperamental. anytime a crosstab query, or a query that the crosstab
query is based on, uses a parameter value, you must use the Eval()
function. if you use this, you won't need to use the Parameter property
for the query.

Nov 13 '05 #5

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...
2
by: Sherman H. | last post by:
I have a few questions for crosstab and popup form questions: 1. I created a crosstab as follows: IT Financial Operation John 21 22 ...
7
by: newguy | last post by:
I am trying to get the totals of a table by client by type of income. This query will get what I am looking for with each unique combination as a row: SELECT Sales.Client, BillCode.Type,...
8
by: Penny | last post by:
(Access 2003 Multiuser Split DB, Windows XP Pro) Hi All, I would really appreciate just some basic tips on how to make a Crosstab Form based on a Crosstab Query. The query always has the same...
14
by: Tina | last post by:
My employer tracks productivity/performance of clinicians (how much they bill) each week, its averages for the month, and the 6 months. These averages are compared to their expected productivity....
27
by: Bob | last post by:
running access 2k; mdb w/ linked tables to another mdb (front/back-end); trying to run a query that updates a table FROM information from a crosstab query. I AM NOTT trying to update the...
4
by: m.wanstall | last post by:
I have a crosstab query that compiles data for Months of the year. I have a stacked select query on top of that crosstab query that uses the latest 2 months data and exports it to a fixed length...
4
by: mattlightbourn | last post by:
Hi all, I have a problem which has been driving me nuts. Crosstab queries! I have a database witch a few different tables to do with garment manufacturing. I have a table for a client...
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...
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
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
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...
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
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,...

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.