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 works but if I enter a field name from the form then I run into trouble.
This is the initial SQL that works: - TRANSFORM First(tblWelderQualification.CertificateNo) AS FirstOfCertificateNo
-
SELECT [First Name] & " " & [surname] AS Name
-
FROM tblWelders INNER JOIN tblWelderQualification ON tblWelders.[Welder ID] = tblWelderQualification.[Welder ID]
-
WHERE (((tblWelderQualification.Project)="filterCriteria"))
-
GROUP BY [First Name] & " " & [surname], tblWelderQualification.Project
-
PIVOT tblWelderQualification.[WPS No];
When I add a parameter and change the critera as below it fails. - PARAMETERS [Forms]![frmQualReg]![Text5] Text ( 255 );
-
TRANSFORM First(tblWelderQualification.CertificateNo) AS FirstOfCertificateNo
-
SELECT [First Name] & " " & [surname] AS Name
-
FROM tblWelders INNER JOIN tblWelderQualification ON tblWelders.[Welder ID] = tblWelderQualification.[Welder ID]
-
WHERE (((tblWelderQualification.Project)=[Forms]![frmQualReg]![Text5]))
-
GROUP BY [First Name] & " " & [surname], tblWelderQualification.Project
-
PIVOT tblWelderQualification.[WPS No];
This fails also, I've only added a parameter here. - PARAMETERS [Forms]![frmQualReg]![Text5] Text ( 255 );
-
TRANSFORM First(tblWelderQualification.CertificateNo) AS FirstOfCertificateNo
-
SELECT [First Name] & " " & [surname] AS Name
-
FROM tblWelders INNER JOIN tblWelderQualification ON tblWelders.[Welder ID]=tblWelderQualification.[Welder ID]
-
WHERE (((tblWelderQualification.Project)="filterCriteria"))
-
GROUP BY [First Name] & " " & [surname], tblWelderQualification.Project
-
PIVOT tblWelderQualification.[WPS No];
When it fails I get the following error from the form:
"You can't use a pass-through query or a non-fixed crosstab query as a record source for a subform or subreport.
Before you bind the subform or subreport to a crosstab query, set the query's ColumnHeadings property."
The reason for using the crosstab query is the number of colums is dynamic and I didn't want to use the pivotchart as my users are more used to the datasheet view.
Any help would be greatly appreciated. Thanks.
3 6595 nico5038 3,080
Recognized Expert Specialist
Crosstable queries are nasty to use for forms and reports.
The basic problem is the fact that the content of a column will be transformed into fieldnames.
Thus when your selection fails to deliver a value or has a new value, then a field will be missing or a new field will be missing.
Best to make sure that all different values are present by using an outerjoin query with a table holding all values.
Personally I often create first a temp table with the selected data and use that for the crosstable query to have no trouble with the selection in the crosstable query.
When a report will work for you, then I can supply you with VBA code to fill a report depending on the result, but the max number of rows will need to be known.
Nic;o)
outerjoin query? I'm not sure how this would be done but i think i undertand your concept
nico5038 3,080
Recognized Expert Specialist
Make a table with all values for the crosstable query.
JOIN that table with the original table and make the "value table" leading (click the JOIN line and chose option 2 or 3)
Now there will always be a value, even a Null will show.
I use the trick e.g. for having all 12 months and by joining to a field with the month all months will show.
Nic;o)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Darleen |
last post by:
I am seeking conceptual here on how to get started with a "3D Matrix"
in Access. We run a training center which holds multiple classes in
multiple cities at multiple times. So I need to create a matrix with
3 "axis". The 3 axes are:
City Location
Week of Class (in 14 week increments that repeat)
Name of Class
The end goal is to be able to have a form that shows these classes in
|
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 Create a Dynamic Crosstab Report
PRODUCT :Microsoft Access
PROD/VER:1.00 1.10
OPER/SYS:WINDOWS
|
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 Format(First(QtrAvg),'Fixed') AS FirstQtrAvg
SELECT PropertyCode, Survey, Question
FROM SurveyData
WHERE PropertyCode = Forms.MainForm.Subform.Form.PropertyCode
GROUP BY PropertyCode, Survey, Question
|
by: krish_4u_only |
last post by:
Hi,
I have designed a subreport - record source is on crosstab query.
crosstab query is designed on union query. The sub report is working
fine when it is opened individually. but if i place it on another
report it is giving the following error:
You can't us a passthrough query or a non-fixed-column crosstab query
as a record source for a subform or subreport.
Before you bind the subform or subreport to a crosstab query, set the
|
by: Johnny M |
last post by:
I have an unbound form with subforms. Some of the subforms are linked to
each other using Master/child relationships (using hidden controls on the
unbound form). I want to add a final subform to the unbound form that shows
the results of another subform in crosstab query style. For instance:
subform1 displays this:
Year Type Amount
1998 ABC 1,000
1999 DEF 250
| |
by: Michael R |
last post by:
Please help me with this.
I have a form in which I would like to present results from a CrossTab query in a subform. I don't need the query to be bounded to a master field. Also, I have a parameter in the query as one of the main form controls. Please look at the query:
PARAMETERS !! Long;
TRANSFORM Sum(LoansSumAmountAndYearAndCity.Amount) AS SumOfAmount
SELECT LoansSumAmountAndYearAndCity.Customers.Id,...
|
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...
|
by: odavison |
last post by:
I've created a Crosstab Query displaying the Consultant ID and the corresponding amount of Appointments they have on a specific date, as well as a count of the number of appointments.
I am trying to get it to display as a subform in the Consultant Form, and I have read around stating that you need to declare your parameters in order for it to work. I have tried to do so but the error message I get is "Too few Parameters. Expected 1."
I'm...
|
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: 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: 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...
|
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...
|
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?
| |