473,748 Members | 3,604 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with date in CrossTab query

I wish to create a crosstab query as the record source for a report.
It needs to count data between selected dates which are entered by the
user in a popup window.

The following Select query works:
SELECT Tasks.EnquirySo urceID, Tasks.BusinessU nitID,
Count(Tasks.Tas kID) AS CountOfTaskID
FROM Tasks
WHERE (((Tasks.TaskDa te)>=[Forms]![SalesStatistics Popup]![fromDate]))
GROUP BY Tasks.EnquirySo urceID, Tasks.BusinessU nitID;

(I have simplified the date selection to be just >= instead of Between
… )

However if I convert this to a CrossTab query:
TRANSFORM Count(Tasks.Tas kID) AS CountOfTaskID
SELECT Tasks.EnquirySo urceID
FROM Tasks
WHERE (((Tasks.TaskDa te)>=[Forms]![SalesStatistics Popup]![fromDate]))
GROUP BY Tasks.EnquirySo urceID
PIVOT Tasks.BusinessU nitID;

I get the error message:
The Microsoft Jet database engine does not recognize “[Forms]!
[SalesStatistics Popup]![fromDate]” as a valid field name or
expression.

How do I create a CrossTab query using a date entered by the user?

Jim

Jul 13 '08 #1
2 3404
Jim Devenish wrote:
I wish to create a crosstab query as the record source for a report.
It needs to count data between selected dates which are entered by the
user in a popup window.

The following Select query works:
SELECT Tasks.EnquirySo urceID, Tasks.BusinessU nitID,
Count(Tasks.Tas kID) AS CountOfTaskID
FROM Tasks
WHERE (((Tasks.TaskDa te)>=[Forms]![SalesStatistics Popup]![fromDate]))
GROUP BY Tasks.EnquirySo urceID, Tasks.BusinessU nitID;

(I have simplified the date selection to be just >= instead of Between
… )

However if I convert this to a CrossTab query:
TRANSFORM Count(Tasks.Tas kID) AS CountOfTaskID
SELECT Tasks.EnquirySo urceID
FROM Tasks
WHERE (((Tasks.TaskDa te)>=[Forms]![SalesStatistics Popup]![fromDate]))
GROUP BY Tasks.EnquirySo urceID
PIVOT Tasks.BusinessU nitID;

I get the error message:
The Microsoft Jet database engine does not recognize “[Forms]!
[SalesStatistics Popup]![fromDate]” as a valid field name or
expression.

How do I create a CrossTab query using a date entered by the user?

Jim
Unlike normal queries, crosstab queries insist that all parameters be
explicitly defined and given a DataType. In design view of the query
right-click on the background of the table area and choose "Parameters " from
the resulting menu (or find this in the query menubar).

In the parameters dialog enter each of your parameters and fill in the
DataType column. You should find that the parameters now work.

Interestingly, even when you have a working parameter query that does not
need to have the parameters explicitly defined you will have to do so if you
use that query as the input to a crosstab query. Sometimes you can get this
message several layers removed from the query you are actually working on.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jul 13 '08 #2
On Jul 13, 5:46*pm, "Rick Brandt" <rickbran...@ho tmail.comwrote:
Jim Devenish wrote:
I wish to create a crosstab query as the record source for a report.
It needs to count data between selected dates which are entered by the
user in a popup window.
The following Select query works:
SELECT Tasks.EnquirySo urceID, Tasks.BusinessU nitID,
Count(Tasks.Tas kID) AS CountOfTaskID
FROM Tasks
WHERE (((Tasks.TaskDa te)>=[Forms]![SalesStatistics Popup]![fromDate]))
GROUP BY Tasks.EnquirySo urceID, Tasks.BusinessU nitID;
(I have simplified the date selection to be just >= instead of Between
… )
However if I convert this to a CrossTab query:
TRANSFORM Count(Tasks.Tas kID) AS CountOfTaskID
SELECT Tasks.EnquirySo urceID
FROM Tasks
WHERE (((Tasks.TaskDa te)>=[Forms]![SalesStatistics Popup]![fromDate]))
GROUP BY Tasks.EnquirySo urceID
PIVOT Tasks.BusinessU nitID;
I get the error message:
The Microsoft Jet database engine does not recognize “[Forms]!
[SalesStatistics Popup]![fromDate]” as a valid field name or
expression.
How do I create a CrossTab query using a date entered by the user?
Jim

Unlike normal queries, crosstab queries insist that all parameters be
explicitly defined and given a DataType. *In design view of the query
right-click on the background of the table area and choose "Parameters " from
the resulting menu (or find this in the query menubar).

In the parameters dialog enter each of your parameters and fill in the
DataType column. *You should find that the parameters now work.

Interestingly, even when you have a working parameter query that does not
need to have the parameters explicitly defined you will have to do so if you
use that query as the input to a crosstab query. *Sometimes you can getthis
message several layers removed from the query you are actually working on..

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt * at * Hunter * dot * com
Thanks Rick, that did the trick

Jim
Jul 13 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
6390
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date ranges, ie between 24/09/2004 and 01/10/2004 together with 05/10/2004 and 07/10/2004 ? If I enter the "Between" criteria on different lines it returns no data.
2
1631
by: Kevin | last post by:
Hi I have created a report based on a Crosstab query the crosstab query is based on another query problem i have is that the results this month may be different next month having tested this by changing the date i find that the field is not recongized how can i design a report that is dynamic i.e.a field may be there this month but not next month
2
2255
by: carl.barrett | last post by:
Hi, I'm back with the same question as I still can't get it to display my data the way I want it to. The table lists information about a perpetrator involved with an anti social behaviour order. The table contains personal information about the individual as well as (here is where the letter dates comes in:) e.g.
3
6611
by: russellhq | last post by:
Hi, I'm fairly new to access and have a little trouble with a crosstab query I've setup. I have a main form where the user selects a project name and below in a subform, a crosstab query is displayed in a datasheet view. The info is dependant on the project picked. What I tried to do is set the criteria in the the query to only show results that match the project name but I am having no success. If I type a name into the critera then it...
1
5257
by: devyon122 | last post by:
I'm trying to allow a user to type in a beginning data and an ending date to be used in a crosstab query - Below is the query: TRANSFORM Count(imagingdb.ID) AS CountOfID TRANSFORM Count(imagingdb.ID) AS CountOfID SELECT imagingdb.Scheduled, imagingdb.ATT, imagingdb.ACQ FROM imagingdb WHERE (((imagingdb.Scheduled) Is Not Null) AND ((imagingdb.ATT) Is Not Null) AND ((imagingdb.ACQ) Is Not Null) AND ((imagingdb.Project) Is Not Null)) GROUP...
4
2472
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 account, garment type (Jacket, skirt, etc), client sizing spec and descriptives (measurement names i.e: Shoulder to cuff, inside leg, etc), available sizes (ie. 4,6,8,10,12,14,16,18,20,S,M,L,SM,ML,One) and pattern adjustments (if size 10 is the base, the...
7
10188
by: sheri | last post by:
I have a field called date, the date is in the field like this 70925 (which means Sept. 25, 2007). I have another field called day, it is a text field. How do I write a query to populate the day field from the date field? Thanks for your help.
4
2317
by: odavison | last post by:
I'm currently running a crosstab query that displays the total amounts of Appointments that each Consultant. Currently it is Consultant ID as the Rows, and Appointment Date as the top headings, grouped by Date (rather than month etc.) But it is giving me a random order of dates going up numerically by day and no more. Is there any way of giving an order to the Date columns or specifying that is should be for the next 7 days etc? here...
5
5082
by: HowHow | last post by:
First time using crosstab query because tired of creating queries and put them together in one query (such a stupid thing to do :D). Not sure how it works still. I have link table called dbo_Roster to access 2000, I try to group data by Service and dates, for example 01/01 to 01/31 is Jan08, 01/02 to 28/2 is Feb08 and so on. The result should be like below : Service Jan08 Feb08 Mar08 Apr08 May08 Jun08 ...
0
9544
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9372
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9324
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8243
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4606
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.