473,378 Members | 1,417 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,378 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 8068
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
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: 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
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...

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.