473,396 Members | 1,689 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.

Access 2007 Crosstab query with parameters

I have a simple database recording complaints. A crosstab query is based on a query which returns resolved complaints only. The crosstab has the field Complaint Type as a row heading and Outcome as a column heading.

I want to be able to select complaints which were resolved in a particular date range (field is Date resolved). This field is in the original query but not the crosstab.

How do I do it?
Nov 12 '08 #1
6 13204
Delerna
1,134 Expert 1GB
In the query that the crosstab query is based off.

In the criteria for the field [Date Resolved] put the following
Expand|Select|Wrap|Line Numbers
  1. [Date Resolved]>=[Please Enter From Date] and [Date Resolved]<=[Please Enter To Date] 
  2.  
the criteria is referencing the fields [Please Enter From Date] and [Please Enter To Date]. Since these 2 fields don't exist in your query, (I hope), an input box will popup for each of them asking you to input their value.

PS
You can use the BETWEEN function instead if you want.
Nov 12 '08 #2
Thank you for replying. I tried that first off but when I try to run the crosstab query I get an error message:

"The Microsoft Office Access database engine does not recognize '[startdate]' as a valid field or expression."
Nov 12 '08 #3
Got it!

SQL is:

Expand|Select|Wrap|Line Numbers
  1. PARAMETERS [start] DateTime, [end] DateTime;
  2. TRANSFORM Count(qResolved.ComplaintNumber) AS CountOfComplaintNumber
  3. SELECT qResolved.[Complaint type], Count(qResolved.ComplaintNumber) AS [Total Of ComplaintNumber]
  4. FROM qResolved
  5. WHERE (qResolved.[Date Resolved] BETWEEN [start] AND [end])
  6. GROUP BY qResolved.[Complaint type]
  7. PIVOT qResolved.Outcome;
  8.  
Nov 12 '08 #4
KingKen
68
I am having hell with my Cross tab query. I am trying to arrive at a table that displays a summary of job status by staff over a given period.

Here is the SQL I am using
TRANSFORM Count(SupportLogs.Status) AS CountOfStatus
SELECT SupportLogs.SupportStaff
FROM SupportLogs
WHERE (((SupportLogs.DateReported) Between [Forms]![frmSearch]![BegDate] And [Forms]![frmSearch]![EndDate]))
GROUP BY SupportLogs.SupportStaff
PIVOT SupportLogs.Status;

When I run this it gives me an error stating that "[Forms]![frmSearch]![BegDate]" is not a valid field name or expression.

I get the same thing if i try to use parameters and have it prompt for the date when it is executed.
Help Please!
Dec 18 '08 #5
Delerna
1,134 Expert 1GB
I havent used a pivot query in access that looks quite like yours so this is only a guess.
I am assuming that you are using text boxes for the dates
Try putting a .Text on the end of those controls.

[Forms]![frmSearch]![EndDate].Text

This statement
I get the same thing if i try to use parameters and have it prompt for the date when it is executed.
leads me to believe it won't work, but worth a try
Dec 18 '08 #6
I don't know if anyone answered this, but I found the answer today in doing the following:

Click on Parameters in your Query Design and enter [Forms]![NameofForm]![BeginDate] and select Date/Time for format. Do this for the begin date and again separately for end date on separate lines and close. Then run your query.
Oct 3 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: DFS | last post by:
I've been working around this for years (I believe), so I figured someone here might know: Why won't a crosstab query accept a value from a form reference? TRANSFORM...
3
by: Bryan | last post by:
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...
3
by: Bill Hutchison | last post by:
I have a query that returns different results (3508 rows for snapshot, 6288 for dynaset) and that is the only thing I change to get the different results. When I try to make a table from the...
1
by: bobykim | last post by:
Hi All, I'm using MS Access 2003 in a Windows XP environment. I've created an aging report for my department that is based on what I call the "Main query" with an IIf statement that allows the...
4
by: rdsandy | last post by:
Hi, I have some code below in VBA for Access 2003 which is on a button called "RentalCrosstabPercTtlQtyMonthLoc_Click". This is a crosstab query which brings up rental items down the side, who...
0
MMcCarthy
by: MMcCarthy | last post by:
Rather than using the Access design view change the view to SQL. I am going to attempt to outline the general syntax used for SQL queries in Access. Angle brackets <> are used in place of some...
23
by: helm | last post by:
Folks, could anyone advise ... Is there a significant difference in crosstab capabilities in Access and Excel? Using Office XP 2002 ... to produce a crosstab report I developed it in Excel from...
2
by: Aussie Rules | last post by:
Hi, I have a access 2007 database with a cross tab query. Based on the selection critieria the cross tab may contain a different number columns in the result. For example if the query is...
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: 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
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
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
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
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.