473,287 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,287 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 13182
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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)...

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.