sueb 379
Contributor
I have a crosstab query that gathers all records for a fiscal year specified by the user's input, then counts the number of records that fall within a specific month, grouped by a discriminant in those records. It's my Surgery database, so I ask the user to enter the 4-digit year that begins the fiscal year; then I calculate the beginning/ending dates for the FY and use those to filter Date of Surgery; then I count the number of records (just using the AutoNumber field) for each Service (General, Ob-Gyn, etc.), grouping them by month.
Here's the SQL as it stands: - TRANSFORM Count(DataTable.Number) AS CountOfNumber
-
SELECT DataTable.Service, Count(DataTable.Number) AS [Total Of Number]
-
FROM DataTable
-
WHERE (((DataTable.[Date of Surgery]) Between CDate("7/1/" & [Enter FY Start Year (yyyy)]) And CDate("6/30/" & ([Enter FY Start Year (yyyy)]+1))))
-
GROUP BY DataTable.Service, [Enter FY Start Year (yyyy)] & ([Enter FY Start Year (yyyy)]+1)
-
PIVOT Format([date of surgery],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
-
and I've attached a page of the report for visual reference.
For the life of me, I can't seem to get the entered Fiscal Year to show up as a field that I can print in the report's title. I've tried a couple of different things, including "making a field of it" in a separate (Expression) column: - FY: [Enter FY Start Year (yyyy)]
but that simply disappears when I re-open the query. It doesn't even object to it, but simply refuses to recognize it.
2 3808
Hi Sue. In your query the user-entered parameter is not available as a field for you to refer to. It is part of the WHERE clause of your SQL, and you will not be able to retrieve it as a value unless you list it also in the fields you select.
In general it is not good practice to use such parameter queries as the basis for a report at all. The user has no guide as to the form of the value required, and in any event you already have values in your tables which you should be able to show to your users in the form of a pick-list from which they select a value.
Accordingly, I suggest that you design a user-form with a combo box providing a drop-down list for the user to select the relevant year before opening the report on the click of a command button. There are many good examples of how to do this kind of thing around, including in the NorthWind example database available as part of your MS Access installation (or separately downloadable if you do not have direct access to it).
You will find lots of useful techniques on designing good user interfaces like this in books such as Building Microsoft Access Applications by John L. Viescas, which I can recommend you read.
-Stewart
sueb 379
Contributor
Oh, yes, Stewart, of course this is how to do this! (so obvious once it's said...)
In addition, I'm very grateful for the recommendation of a good book. I don't have an adequate one, and haven't been able to tell (just from reading reviews on Amazon) which to buy. Double thanks for that!
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 want them to
do as little as possible when they run their reports.
I have a crosstab query that displays usage of items for each month.
It looks pretty much like this:
ITEM DESC UM 12/02 1/03 2/03 3/03 ...ETC.
1 Solution ...
|
by: No Spam |
last post by:
Dear Access 2000 users,
I have a crosstab query that puts together certain information
perfectly. It has a criteria that is based on a form that limits how
many columns are returned based on the date selected. Here's the
problem:
The report that the crosstab query feeds was initially created to show
all the dates and thus, all 26 columns. However, since I modified the
crosstab query to only return up to what is selected on the...
|
by: Judy |
last post by:
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...
|
by: x |
last post by:
hi
i have made a crosstab query in which row heading is "date", colum
heading is "aircraft type" and the value to be summed up is "1-10 row
totals". i want to create a simple query which should just give me the
total value of "1-10 row totals" field by defining a certain criteria.
now when i write the following in the criteria field
Between and
i get an error message saying "The microsoft jet database engine
doesn't recognize as a...
|
by: Keith Wilby |
last post by:
I have a report that is based upon a crosstab query which return only the
columns (fields) it has data for. When my report runs it sometimes fails
because some of the text boxes don't have a field in the query. I've
written some code to "fake" the missing field names which works perfectly
but is quite complex and I'm wondering if there's a simple light bulb
shining somewhere that I'm missing. The field names returned by the
crosstab are...
| |
by: Mike |
last post by:
Hi,
Im trying to create a crosstab query with fewer than 255 headings
(about 50), but it crashes when I try to save after writing the heading
names in the query property "column headings". My list is pretty long,
but far from having 255 entries.
I specify which columns I want so that it doesn't give me an error
message because a field has no valid data attached to it.
|
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...
|
by: Coastie |
last post by:
Good afternoon-
There is a table with the following fields:
PK*, Equipment_ID, Battery_Serial
*= arbitrary primary key
Each piece of equipment has between 0 and 3 batteries, and each battery has a non-sequential serial number. Unfortunately, this creates multiple records for each piece of equipment. I want a query that consolidates the information onto a single line for each piece of equipment. The fields I need are:
Equipment_ID,...
|
by: Paul H |
last post by:
I want to base a form on a crosstab query. The query shows statistics
for a user defined period. The column headings will look something
like this:
ClientID Month01 Month02 Month03 etc..
So if the user selects 3 months in the criteria form, there will be 3
(month) column headings, if he selects 6 months, the will be 6
headings.
|
by: Jim Devenish |
last post by:
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.EnquirySourceID, Tasks.BusinessUnitID,
Count(Tasks.TaskID) AS CountOfTaskID
FROM Tasks
WHERE (((Tasks.TaskDate)>=!!))
GROUP BY Tasks.EnquirySourceID, Tasks.BusinessUnitID;
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |