Queries :: Dynamic Cross Tab Query - Column Sort By Corresponding ID
Apr 23, 2015
I have a dynamic cross tab query - thus the column headings will change each time it is run.
At present the column headings are displayed in alphabetical order - how can I change this so they are based on a different order - eg by the descriptions corresponding ID
I have an access 2000 database and i want to make a cross tab query with 2 column headers but access doesnt allow thatI decide to make the inverted cross tab query and its okbut now i want to use this in a report but invertedex product type client1 client2 client3 a 1b 2c 3 product a product b product c type 1 type 2 type 3client1 client2 client3
Not able to add more column heading in cross tab query. I tried to change the query properties to add more column headings as given below. In the query's Design view, right-click up in the area where your tables are shown and choose "Properties" from the right-click menu. The 3rd line down is for Column names. Enter what you need there.
Evn after doing it. i am not able to . Whn I try to save or view the datasheet it says. to create a crosstab query u need to have one or more row headin one column headin and one value.
I created a dynamic crosstab report with 4 unbound fields in the details section and 4 unbound fields in the header section, which all work perfectly well. The crosstab query contains 17 columns. The last 4 columns contain the values I need to take the sum of. I have put some code in the open event procedure of the report.
Private Sub Report_Open(Cancel As Integer) Dim rs As DAO.Recordset Dim db As DAO.Database Set db = CurrentDb Set rs = db.OpenRecordset("Select * from Que_ProjectUren_Sel_Dept_Test")
I have made a cross-tab query which works fine. I also have made a report which is based on this cross-tab query. Due to nature of the cross-tab query the Value column(s) is dynamic. The report I made is based on all available data types (columns). The report works if all data type is available but the report fails if some of the data types are not available (i.e columns are missing due to not having any value or data). I hope I am explaining this correctly,
Is there a way I can use expressions in the report to place a conditional clause that if the Control Source doesn't exist place a Null or 0 in the report or in its place.
I have a cross tab query. Essentially it groups together posted volumes into week numbers for different offices.
However, when I run the query, the order of the columns is not in a logical number order. I get Week 1 then Week 10 then Week 11 and Week 2 is further down the list and then Week 20 comes after that.
I would like if at all possible the Week Numbers to follow after one another i.e. Week 1 first then up to Week 52 in correct number order.
In my Dates Table I do have a SortID column which I hoped would resolve this issue so I could sort on the SortID column however this fails to work.
Attached is the query...
Code: PARAMETERS [Forms]![frmSumOfVolByCCAndFormat]![cmbOfficeSearch] Text ( 255 ), Forms![frmSumOfVolByCCAndFormat]![txtStartDate] DateTime, Forms![frmSumOfVolByCCAndFormat]![txtEndDate] DateTime; TRANSFORM Sum(tblTrafficEast.TrafficVolume) AS SumOfTrafficVolume SELECT tblOffice.CostCentre, tblOffice.OfficeName, tblTrafficFormat.Format, Sum(tblTrafficEast.TrafficVolume) AS [Total Volume]
I asked 18 people to each sort 100 statements into piles based on the similarity of the statements. The results are arranged as below.For example:
- Bob sorted statements 1, 3, and 100 into the same pile (Pile ID = 5), and statements 2 and 4 into the same pile (Pile ID = 2). - Mary sorted statements 1 and 100 into the same pile (Pile ID = 3).
Code: SubjectID StatementID PileID ------------------------------ Bob 1 5 Bob 2 2 Bob 3 5 Bob 4 2
[code]....
I need to create separate summaries for each Subject. The summary should indicate, for every possible pair of statements (1 & 1, 1 & 2, 1 & 3 ... 100 & 100), a 1 if the person sorted both statements into the same pile and a 0 if they didn't. Identical statement pairs (e.g., 1 & 1) should always get 1.
Code: StatementIndex1 StatementIndex2 Similarity 1 1 1 (identical statements always get a 1) 1 2 0 (Bob did not sort statements 1 & 2 into the same pile) 1 3 1 (Bob sorted 1 & 3 into the same pile) 1 4 0 (Bob did not sort 1 & 4 into the same pile)
[code]....
I'm assuming a crosstab query is a start, but I couldn't figure out how to set it up.
The asterisks indicates the index keys. While TableMonthlyReport has 2 links of relationship with the TableGoods on IDCatalog and IDItem.
I have a data entry front end for monthly report. I have no problem to have the record source for this purpose.
I just need that the sort order of the item (in the front end) in a way that they could be managed differently on different period. For example, in March to April 2007 I want the items shown in the following order: A B C D ... While in May to August 2007 I want the items shown as B D A C ....
I tried to create an order table just like this: TableGoodsOrder: *IDCatalog *IDItem *ValidStart ValidEnd OrderItem
It is linked with the TableGoods on IDCatalog and IDItem.
The first order list (March - April 2007) will have the ValidStart of 703 and ValidEnd of 704. While the next order list will have the ValidStart of 705 and 708. The last 2 digits stand for the month, while the first digit is to indicate year.
The SQL query for the record source works but I can not enter any value. So, the idea of having a special table for sort order is not OK.
I have a form that shows multiple rows of linked/child records.The form in question is the "frmFilterNumberTypeView" form. When a particular filter is used (installed on an automobile), I would like to be able to click on the corresponding "Installed 1" button left of the filter number, so that by code, I can reduce the Qty on Hand by One, and insert the corresponding filter ID to the History table, along with the date/time the filter was used.
how to reduce the Qty on Hand, nor how to do the updates to the History table, I'll figure that out myself over the next week or two (hopefully it won't take that long). What I'm trying to figure out here is how I can associate the red "Installed 1" button with the filter to the right of whichever button I press.
how to sort the filter column on this same form. I'm fairly certain that this would be very easy to do if the subform in question was populated by means of a corresponding query, but I'm afraid that if I go that route that I'll spend another 20+ hours trying to figure out how to get the proper filter records to match the filter manufacturer, not to mention having to next figure out how to link the table so that if I modify any particular filter record, that I'll be able to have the associated table update accordingly.
Is it possible to sort the filter column without the subform record source being a query?
I am trying to run a simple update query to copy data from one column (Addrl1)to another column (Working_Addrl1) within the same file and I can't for the life of me figure it out. Then I need to repeat for addrl2 and addrl3 to working_addrl2 and working_addrl3.
I have created a cross tab to extract pipeline and sales for Q1 2014, Q2 2014, Q3 2014 & Q4 2014... the user can select the quater from a multivalued text box...
Now for the final output, have created another query which pull the above four quarter in each column from the cross tab...now the problem arises when i change the quarter to Q2 2014, Q3 2014, Q4 2014 & Q1 2014..it gives an error "Microsoft office Access database does not recognizes "Query name" as a valid field name or expression".
The error is because the second layer of query does not identifies Q1 2014.
How do i make access change the column automatically when the Q1 changes to Q2...
Sometimes i have a problem with dynamical queries. For some of these i need to put in the same parameter value two times, before it works. Why this occurs?
I am looking to add a column in a query that will give a Y or No to previous column data if it contains TEXT or NUMBER (It could read "TEXT" or "NUMBER" or even Y for text or N for number).
I have a created a crosstab query which gives me the results I need, but I want to sort the row headings differently. These are not numbers, but machine sizes which range from 4 Metre to 20 Metre. Currently, the crosstab gives me:
10 Metre 12 Metre 14 Metre 17 Metre 20 Metre 3 Metre 4 Metre 5 Metre etc
But I need to show it as:
3 Metre 4 Metre 5 Metre 10 Metre 12 Metre 14 Metre 17 Metre etc.
The field is short text data type and data comes from an ODBC linked table to SQL server table, and I am using Access 2013.
I have a number of cross tab queries which I run on a weekly basis, each of which is running from a different date field in the database (e.g. one query for orders received based on 'Received Date', another for orders complete based on 'Received Date'. On a weekly basis I have to open each query in design view, edit the start and end date for the week and execute the query. It would save significant time if I could enter a date range once into a form and run the series of queries based on these parameters. Any thoughts?:) :)
This is something I occasionally see in Access and has been bugging me for quite a while.
As an example, when I have a table (all text fields except for the ID field which is an Autonumber with a unique index - ie just what Access creates when you import data) and I try to make a new table from a query by indexing the Autonumber field in descending order (ie to reverse the order of the table), it doesn't work properly.
So if I have:
SELECT [mytable].* INTO [mytable sorted] FROM [mytable] ORDER BY [mytable].[ID] DESC;
When I preview the data (ie run the select query to have a look at it), it looks fine.
When I change the query to a 'Make Table' and I then I check the table it makes, the order changes part-way down the list, so looking at the ID field it runs from number 2669 down to 2087 correctly, then it goes from 1960 to 1956, then 1803 to 1799, then 1751 to 1747, etc etc etc. After a while it seems to correct itself again, and orders normally down to #1
I have a Union Query (that works perfectly fine) with the following code:
Code: SELECT * FROM sbqryUseBattery UNION SELECT * FROM sbqryUseBeltsDeck; UNION SELECT * FROM sbqryUseBeltsHydro; UNION SELECT * FROM sbqryUseBeltsPTO; UNION SELECT * FROM sbqryUseFiltersAir UNION SELECT * FROM sbqryUseFiltersFuel UNION SELECT * FROM sbqryUseFiltersOil;
I am using this information on a Report.
The problem is that the Report shows the data in random order. Is there a way to filter either the Union Query or the Report?
Is it possible to sort a natural table drop down by date from within a query? What im doing:
1. making a query that has certain results displayed 2. within the query you can select one of the field boxes and it has a list of all the items in that table. 3. is it possible to sort this natural table listing from within the query. I have attached a screenshot. Same thing happens with the client ID listing from within the query. Want to know if it is possible or not to sort those. I cant see how.
I cannot sort below query in descending order by absolute value. If I do not use sort, all works fine but as soon as I try to sort by absolute value I get message to 'Enter Parameter Value'. I tried to replace Abs([Variance (W2 - W1)]) with filed name AbsoluteValue and still the same result ;(
Code:
SELECT [Query Union].[Stock Code] AS SKU, [Query Union].[Pallet No] AS [Pallet No], [Query Union].[Batch No#] AS Batch, IIf(IsNull([qW1 SOH].[Physical stock]),0,CDbl([qW1 SOH].[Physical stock])) AS [W1 Qty], IIf(IsNull([W2 SOH].[Good Stock]),0,CDbl([W2 SOH].[Good Stock])) AS [W2 Qty], [W2 Qty]-[W1 Qty] AS [Variance (W2 - W1)], Abs([Variance (W2 - W1)]) AS AbsoluteValue
I have this cross table for a query called OUTPUT. The query has four fields (country, indicator, value and date). I want to cross table by date as follows:
Code: TRANSFORM Sum(OUTPUT.value) SELECT OUTPUT.country, OUTPUT.Indicator FROM OUTPUT GROUP BY OUTPUT.country, OUTPUT.Indicator PIVOT OUTPUT.[date];
This works fine but I'd like to visualise the date formatted by quarters instead of dd/mm/yyyy. I have modified my SQL code as follows:
Code: TRANSFORM Sum(OUTPUT.value) SELECT OUTPUT.country, OUTPUT.Indicator FROM OUTPUT GROUP BY OUTPUT.country, OUTPUT.Indicator PIVOT "Q" & DatePart("q",OUTPUT.[date]) & " " & Year(OUTPUT.[date]);
My problem is that using the DatePart and Year functions I miss the sorting.
Is there any approach that allows me to keep the date sorted in the cross table?
I have also tried to include the date formatting in the OUTPUT query and to sort the date there. It works fine there but when I create the cross table I again loose the sorting.