473,322 Members | 1,755 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,322 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 8061
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.