General :: Cross Tab Query To Display Data By Rows And Columns
Jul 10, 2013
I have a cross tab query that displays data by customer (rows) and MONTHS (columns).
However I need the columns to be the 12 months of the year 1 to 12.
However, if the selected data for a particular customer does not have any records in a month then I get an error in the report as the cross tab query only selects the months with data.
How do I get the report to show 0 or a blank in these columns
View Replies
ADVERTISEMENT
Sep 23, 2013
I have written a query where it displays sorted data for two columns, but problem is its sorting on one column but not on another.
When checking the query separately its giving proper output, but in form view its sorting only on one column not on another.
View 1 Replies
View Related
Mar 20, 2005
I have a two tables in my database related to employee ratings
Employee
TokenID
Division
Band
PMRating
TokenID
H1
Now this statement
Code:SELECT DISTINCT Employee.Band FROM Employee
This would display me all the band levels within Employee table in each row..
Is there any way I could built a query to the Band names as seperate columns?
i'm doing this so as to display the average H1 rating for each Band level ..that is grouped by Employee.Division..
View 2 Replies
View Related
Mar 29, 2012
I have a database with all the hours employees have logged stored in the database. Our payroll company wants an excel spreadsheet that has very specific info in particular columns and fields on the excel spreadsheet, so I'm trying to design a query which will put the correct info in the correct fields per their system.
The challenge is, I have currently a query with Employee ID, Overtime Hours, and Regular Hours as separate columns.
I need to translate this to a query with a single column for hours and a separate column that designates those hours as OT or Reg, with two rows for those employees who have both types.
Current:
ID / Regular Hours / OT Hours
101 / 70 / 7.5
102 / 30 / 0
103 / 5 / 0
Needed:
ID/ Hours / Type
101 / 70 / Reg
101 / 7.5 / OT
102 / 30 / Reg
103 / 5 / Reg
I don't know how to create a query or a formula in a query to break out each employee row into multiple rows with different data in the hours column. It seems like there's something pretty straightforward that I've done in a similar vein but it doesn't seem to work - I can do the opposite and combine those hours by using the SUM function in a query, but I can't seem to break it out this way.
Access 2007, Windows 7.
View 5 Replies
View Related
Sep 12, 2013
I think the answer to this question is going to be a flat 'No', but here we go.
I want to have something like a datasheet, except with with records shown as columns instead or rows.
For clarity, a datasheet displays records as rows, like this:
field 1 field 2
record 1 record 1
record 2 record 2
I'm wanting to present the data the other way around, like this:
field 1 record 1 record 2
field 2 record 1 record 2
Just to complicate matters, the number of records to be displayed is variable, so it should add more columns as required.
About the only option I can think of is to create a subform with fields stacked in a column without labels, and try to dynamically stack the forms as needed, hooking them up to the correct data on the fly.
Alternately, I wondered if I could dynamically generate a recordset with each record containing the field value of multiple records. I can see myself getting into trouble trying to update data this way however.
View 1 Replies
View Related
Nov 26, 2013
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]
[Code] ....
View 3 Replies
View Related
Aug 8, 2013
I was able to use the UNION ALL qry. But, when I have another file (like original2) that does NOT have all the columns listed in the UNION ALL qry, I get a Parameter value box asking for the missing columns when I run the qry.
Example:
original1IDDateGroupChristianJohnnySteve 18/5/2013A1528/5/2013B338/5/2013C2348/5/2013D2358/5/2013E5
original 2IDDateGroupChristianJohnny18/6/2013A212528/6/2013B2338/6/2013C2248/6/2013D22
The UNION ALL qry includes all the possible resources ( includes all the possible column fields Christan, Johnny, and Steve).
When I run the UNION ALL qry with the original2 file, An "Enter Parameter Value" box is displayed with the mssing column name "Steve".
Is there a way to Map the original2 table into a working table with all the columns, or use VBA code to construct the UNION ALL qry to only include the existing columns? My data has variable columns and I'm trying to avoid the parameter popups.
View 2 Replies
View Related
Jul 31, 2013
I am trying to convert a table that looks like the following...
Customer Name SumofSum of Bill Rate Reviewer
000462 John 500 Mike
000224 Mike 900 Jeff
I would like to covert it to....
Customer 000462 000224
Name John Bill
SumOfSum.. 500 900
Reviewer Mike Jeff
I don't think Access has any functions for this but I am not 100% sure. I know this can be done in a Module but I am not sure of how to code it.
View 14 Replies
View Related
Mar 11, 2007
Hi, I have data from a form on my website in a text file, that corresponds to each visitor's input, each 13 lines in the form belongs to one visitor, as shown (twice) at the end of this message.
What I would like to do is have each visitors inputs translated to ONE row, with 13 columns/fields each. It could be appended to the same table or preferably generated in a new one. Note, there are no blank fields, some won't have data after their title, i.e. addy_line_2: is often blank, but at the very least, addy_line_2: or another field name is always there.
It would ROCK if I could also automatically take the name of each field out, i.e. each name is continuous characters up to the : (colon) ...
Thanks in advance, my Access knowledge is obviously limited, I'm sure this is fairly simple!
The fields:
Phone: 213-555-1212
Submit: Continue
addy_line_1: 1000 Melrose Place
addy_line_2:
badge:
city: Los Angeles
email:
homegroup:
name:
program:
state: CA
volunteer:
zip:
Phone:
Submit: Continue
addy_line_1:
addy_line_2:
badge:
city:
email:
homegroup:
name:
program:
state:
volunteer:
zip:
thank you thank you thank you thank you thank you !!
View 1 Replies
View Related
Jan 19, 2006
Hi everyone,
I can't get my head around this so I'm looking for some help if possible please, there are two questions, the first is:
When in the query, I want the criteria for the date selection to be a question, ie. "[Week Start Date?]" but I want the actual criteria selection to be from the start date plus 5 days, the only way I've done that so far is to do ">=[From?] and <=[To?]", which uses two questions and I don't seem to be able to do ">=[Week Start Date?] and <=[Week Start Date?]+5" which seems basically correct, but I expect I'm writing it incorrectly (basic access knowledge I'm afraid :( )
The second question (after I've got the 5 day date criteria sorted) is that the query produces a table that shows basically the following:
Name Store Date Visited
Tom Bury 18/01/06
Tom Bury 19/01/06
Tom Diss 20/01/06
Dick Thetford 18/01/06
Harry Diss 20/01/06
The query is based on a part week period with the starting date ALWAYS a Monday, so no more than Mon-Sat will appear, I want to put the information into a table or query, so the result ends up as:
Name Store Mon Tue Wed Thu Fri Sat
Tom Bury 18/01/06 19/01/06 'Blank' 'Blank' 'Blank' 'Blank'
Tom Diss 'Blank' 'Blank' 20/01/06 'Blank' 'Blank' 'Blank'
Dick Thetford 18/01/06 'Blank' 'Blank' 'Blank' 'Blank' 'Blank'
Harry Diss 'Blank' 'Blank' 20/01/06 'Blank' 'Blank' 'Blank'
*Where the blanks are simply left empty, rather than putting in the word 'blank'
Essentially converting the "[From?]" (as stated earlier) or "[Week Start Date?]" to Monday, that date + 1 to Tuesday, etc, BUT putting multiple dates relating to name and store criteria onto one record :eek:
Beyond me I'm afraid, any pointers would be seriously appreciated, I expect I'm approaching the problem from the wrong angle.
Regards
Tony
View 1 Replies
View Related
Jan 19, 2006
Hi everyone,
I can't get my head around this so I'm looking for some help if possible please, there are two questions, the first is:
When in the query, I want the criteria for the date selection to be a question, ie. "[Week Start Date?]" but I want the actual criteria selection to be from the start date plus 5 days, the only way I've done that so far is to do ">=[From?] and <=[To?]", which uses two questions and I don't seem to be able to do ">=[Week Start Date?] and <=[Week Start Date?]+5" which seems basically correct, but I expect I'm writing it incorrectly (basic access knowledge I'm afraid :( )
The second question (after I've got the 5 day date criteria sorted) is that the query produces a table that shows basically the following:
Name Store Date Visited
Tom Bury 18/01/06
Tom Bury 19/01/06
Tom Diss 20/01/06
Dick Thetford 18/01/06
Harry Diss 20/01/06
The query is based on a part week period with the starting date ALWAYS a Monday, so no more than Mon-Sat will appear, I want to put the information into a table or query, so the result ends up as:
Name Store Mon Tue Wed Thu Fri Sat
Tom Bury 18/01/06 19/01/06 'Blank' 'Blank' 'Blank' 'Blank'
Tom Diss 'Blank' 'Blank' 20/01/06 'Blank' 'Blank' 'Blank'
Dick Thetford 18/01/06 'Blank' 'Blank' 'Blank' 'Blank' 'Blank'
Harry Diss 'Blank' 'Blank' 20/01/06 'Blank' 'Blank' 'Blank'
*Where the blanks are simply left empty, rather than putting in the word 'blank'
Essentially converting the "[From?]" (as stated earlier) or "[Week Start Date?]" to Monday, that date + 1 to Tuesday, etc, BUT putting multiple dates relating to name and store criteria onto one record :eek:
Beyond me I'm afraid, any pointers would be seriously appreciated, I expect I'm approaching the problem from the wrong angle.
Regards
Tony
View 2 Replies
View Related
Jun 30, 2006
Hi all,
I have a query which runs off a table. I have the following Fields as columns in query: WeekID, A, B, C, D, E
For each week, the letters correlate points given. So for week 1, "A" could have 1 point, "B" could have 3 points, etc.
I want to run a Query that will show A, B, C, D, E as rows like the following:
Letter_Week 1_____Week 2_____Week 3
A_______1_________5___________3___
B_______3_________4___________2___
C_______2_________1___________7___
D_______6_________3___________3___
D_______3_________1___________4___
I can't run a crosstab because it will only crosstab values within all of A, B, etc.
Any idea guys? Thanks in advance, as always.
Caliboi
View 3 Replies
View Related
Apr 7, 2015
I am trying to change the data in my rows to columns...I have data as per the attached picture in columns B-I...I would like the rows to be pasted to columns as per columns M-Q...so row 1 ends up as the first lost of data in M-Q and row 2 ends up as the second lot of data.There are numerous rows in my actual file.
View 6 Replies
View Related
Sep 28, 2013
I am just starting out learning how to connect Access to Excel. From an Access form, I need to connect to an Excel spreadsheet, and loop through every row/column to look for data that matches a database field data, then populates the associated cell data. I don't want to import the spreadsheet since the user who created it is using it manually, and I am attempting to automate the task. This is probably the most elementary code, but I would like to start out with the best way to do this. What I am finding is code that appears to be much more complicated than I need, for more complicated situations.
View 2 Replies
View Related
Oct 14, 2013
The key field is the specimen number and specimen type. Currently for every antibiotic there is a row with its result. My output is 3 complete worksheets so a lot of data. I need to create a database with one row per specimen number/type to include whether it is S/R/or I for each type of antibiotic. The example probably makes more sense. but I'm assuming that 65000 rows * 3 sheet can then be reduced to around 18,000 rows.
View 4 Replies
View Related
Jul 30, 2013
I have a big Excel file with payroll information about employees. Per employee per date, there are a couple of rows with mostly identical data (such as the employee's home address) but 2 differences: one will have paycode A with amount B, another will have paycode C with amount D, etc. I want to simplify the file to have 1 row per employee per date: in the example given that row would have paycode A with amount B as well as paycode C with amount D, in 4 separate columns.
I think I can technically solve this by creating Excel files per pay code/amount, and then linking them together by person and date, 1 by 1, through Access. This is feasible because there aren't that many different pay codes. But still, I was wondering if there was anyway to solve my problem in Access itself.
View 1 Replies
View Related
Oct 17, 2013
I have a database with a form that has 3 fields in a subform. I need to paste there data from multi rows. Now I have to do this column by column and paying attention that I select them correctly. Is there a way to directly insert the data by selecting only 1 field and have the data directly there as it would in excel?
Now we use excel as a "between" road to paste it there and then copy it from excel and paste it into access.
View 9 Replies
View Related
Aug 22, 2005
I have a query which is grouped by year, facility name, and billing type and needs to display several columns of aggregate values for each of these, e.g. count of cases, sum of cases reviewed, average length of stay, etc. It would look like this:
2003 ABC Hospital Billed DRG 123 22 6.5
2003 ABC Hospital Billed Per Diem 23 0 4.2
2003 DEF Hospital Billed DRG 456 120 12.3
2003 DEF Hospital Billed Per Diem 56 10 2.1
However, if a facility does not have any Per Diem billings for example, how can I generate a row for it anyway? I cannot use a crosstab since I have multiple different values to display. I tried the following union query:
SELECT YR,FacilityName,BilledDRG,NumberOfCases,AverageLen gthOfStay,CasesReviewed,CasesDenied,AvgOflos,[Billing Eligibility] FROM qryDistHIVCasesStatsDAC
UNION SELECT YR,FacilityName,BilledDRG,0,0,0,0,0,null FROM qryDistHIVCasesStatsDACDRG
UNION SELECT YR,FacilityName,BilledDRG,0,0,0,0,0,null FROM qryDistHIVCasesStatsDACPD
ORDER BY YR, FacilityName, BilledDRG;
where qryDistHIVCasesStatsDAC
is the original query,
qryDistHIVCasesStatsDACDRG shows the year, facility name, and "Billed DRG"
qryDistHIVCasesStatsDACPD shows the year, facility name, and "Billed Per Diem"
but then I would get e.g.
2003 ABC Hospital Billed DRG 123 22 6.5
2003 ABC Hospital Billed DRG 0 0 0
2003 ABC Hospital Billed Per Diem 23 0 4.2
2003 ABC Hospital Billed Per Diem 0 0 0
2003 GHI Hospital Billed DRG 456 120 12.3
2003 GHI Hospital Billed DRG 0 0 0
2003 GHI Hospital Billed Per Diem 0 0 0
what I want is:
2003 ABC Hospital Billed DRG 123 22 6.5
2003 ABC Hospital Billed Per Diem 23 0 4.2
2003 GHI Hospital Billed DRG 456 120 12.3
2003 GHI Hospital Billed Per Diem 0 0 0
In other words, for each year, each facility should have a row "Billed DRG" and a row "Billed Per Diem" and only one row of each.
Thanks for your assistance. I hope I have explained this adequately.
View 5 Replies
View Related
Jun 2, 2005
Is it possible to total columns in a query? Right now, I have a query that produces the following column counts, but I'd like to total Pending, Overdue, etc. This data is being displayed in a subform.
Process Pending Overdue Total
-------------------------------------
Engineering 1 2 3
Procurement 0 6 6
<etc>
-------------------------------------
TOTAL 1 8 9 <- this is the line I want to add
Here's what the query (qryStatusRptB) looks like thus far:
Field: Process
Table: tblProcesses
Total: Group By
Field: Pending
Table: qryStatusRptA
Total: Sum
Field: Overdue
Table: queryStatusRptA
Total: Sum
Field: TotalRecords: Count(*)
Table:
Total: Expression
Can someone explain how to get the TOTAL ROW in here? (I can do it via another query, but that won't work since the data is displayed in a subform. I've tried crosstabs without success.)
Many thanks,
Christine
View 2 Replies
View Related
Jul 28, 2014
I'm trying to make a sub form that displays the hours of an employee selected in a listbox. I've got most of it working but having a bit of an issue.
The info for thre query is in 3 tables:
tblStaff (name etc)
tblShifts (start and end times for days that this employee works)
tblDays (a list of days names so I can use numbers elsewhere)
My query looks like this:
Code:
SELECT tblDays.dayName, IIf(Nz([startTime],"")="","NWD",[startTime]) AS start, IIf(Nz([endTime],"")="","NWD",[endTime]) AS [end], tblStaff.staffName
FROM tblDays LEFT JOIN (tblStaff RIGHT JOIN tblShifts ON tblStaff.staffPK = tblShifts.staffFK) ON tblDays.dayPK = tblShifts.workingDay
WHERE (((tblStaff.staffName)=[Forms]![frmMain]![lst_myTeam] Or (tblStaff.staffName) Is Null));
This worked fine with a single user and some test data - it correctly displayed all days of the week, with start/end times on Mon and Tues where I had entered shift information, and "NWD" against all other days.
However, when I add a couple more employees to the mix it shows the correct info for the first employee, but anybody else it will only display days where person 1 doesn't have any hours. I haven't entered any hours for the new employees, but the query should still display Mon-Sun with NWD in every column. It shows Wed-Sun but Mon and Tues are missing.
I've tried different join types but they all come back with "ambiguous joins" error when I try to run.
View 4 Replies
View Related
Apr 22, 2014
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.
View 2 Replies
View Related
Aug 1, 2013
I have the following query which returns 2 columns, where 2 fields are summed :-
Code:
SELECT Sum(Stats.[No of Invoices Checked]) AS [SumOfNo of Invoices Checked], Sum(Stats.[No of Incorrect invoices]) AS [SumOfNo of Incorrect invoices]
FROM Stats
WHERE (((Stats.Period)=[Forms]![frmMain]![cboSingleMonth].[Value]));
This displays :-
345 - 988
How can I have the data displayed as
345
988
when I run the query.
View 4 Replies
View Related
Jun 20, 2013
I am new to Access and have been hitting a wall and seem to be finding nowhere that has this same type of task.
I have a table(Table 1 ) with 3 columns...
Table 1
I am trying to run a query that returns Table 1 but excludes rows that meet multiple criteria. I need to return rows that do NOT contain the combination of criteria below
Criteria
1) Lot Number - Left([Lot Number],2) = "PT"
2) Transaction Desc. - "Put-away"
Basically, i want exclude a "Lot number" starting with "PT" IN COMBINATION WITH a "Transaction Desc" of "Put-away". The goal is for the query to return ROW2 and ROW3 and exclude ROW1.
ROW1 would be excluded from the query result because it meets both criteria.
ROW2 and ROW3 would be included because it does not fully meet all criteria.
View 3 Replies
View Related
Jul 31, 2013
I am trying to convert a table that looks like the following...
Customer Name SumofSum of Bill Rate Reviewer
000462 John 500 Mike
000224 Mike 900 Jeff
I would like to covert it to....
Customer 000462 000224
Name John Bill
SumOfSum.. 500 900
Reviewer Mike Jeff
I don't think Access has any functions for this but I am not 100% sure. I know this can be done in a Module but I am not sure of how to code it.
View 12 Replies
View Related
Jun 20, 2013
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.
View 1 Replies
View Related
Apr 2, 2013
I have 4 queries in which data needs to be connected from the date and shown as a single date showing each sections entry in a row and a cumulative total is maintained as the balance .
See the attached image ...
View 7 Replies
View Related