Query Transpose Help
Apr 7, 2006
Hi,
I've attached a small JPEG file showing some query results and some data transposing I'm trying to work inside of Access. The top box shows the how my query results currently come up. The lower box shows how I would like to transpose this data so it can easily be exported to other things. I can handle the export part, but I am having trouble with getting the results to fit into my desired format while still in Access. I don't want to convert it outside of Access b/c that would add another step of things to do.
Any ideas would be appreaciated..
Thanks
View Replies
ADVERTISEMENT
Jul 10, 2006
Not sure if transpose is the right term but what I want to do it the following:
I have the following tables (in bold) and members
horse
id
trainer
..
..
prev_form
id
date
horse_id
position
..
..
race
id
date
...
..
race_starter
race_id
horse_id
what I am trying to do is get a query that for each race_starter in a race will display in one row:
race_id,horse_id,date,horse.trainer...,prev_form.i d[0],prev_form.position[0]....,prev_form.id[1],prev_form.position[1]....,.......prev_form.id[4],prev_form.position[4]...
So a horse has many prev_form entries. I want to display the last 5 before the race date but need it to be in one row with the rest of the data. Above [0] would be most recent and [4] would be 5th most recent.
Any clues on how this could be done.
Thanks in advance,
blocka.
View 1 Replies
View Related
Jul 24, 2014
I am trying to generate a simple report that can be imported to excel for analysis. Currently the database documents failure causes associated with a repair. I need a "Report" that does not duplicate the failed items in the event there is more than one cause associated with the failure. some repaired items may have up to 3 causes of failure. What I would like to do is have the query show one record instead of three records (for the cases were three causes of failure were identified for a repair)
Current query format
Code:
facilityID Failure Cause
1 Electrical Surge
1 Mechanical Wear
1 Corrosion
2 ......
2 ......
.... ......
Desired query format
Code:
FacilityID Failure Cause(s)
1 Electrical surge, Mechanical wear, Corrosion
2 .....
.... .....
I was reading about a SQL transpose call but I do not need all fields transposed (only the failure causes transposed and concatenated into one field).
Test database attached with a query that shows the data I want to transform into the desired format.
View 6 Replies
View Related
Nov 12, 2007
I have a table with one field and 83 records. I need to transpose this one column to 83 columns, so I would have a table with 83 columns and one row…. Is there any way to do this?
Appreciate
Maryam
View 1 Replies
View Related
Apr 14, 2006
Hi - Question number two..
Is it possible to transpose the subform data set. I have a subform which lists alleles. There are a variable number of alleles in the subform, which is linked to a second subform. Each allele has a size and a frequency.
It is listed in a tabular format, but the default is top to bottom layout. Is there anyway to display this left to right?
Cheers,
View 2 Replies
View Related
Nov 12, 2007
I have a table with one Field and 83 records. I need to transpose this one column to 83 columns, so I would have a table with 83 columns and one row…. Is there any way to do this?
Appreciate
Maryam
View 4 Replies
View Related
Aug 9, 2007
Hey,
This is not really a transpose, i think.
I don't have much practical experience with Access database so please help with the simplest solution..
I have a table with some data and I want to convert (or create a new one) table into a different format.
my table has the following format...
serial_n 100 500 1000
95x45 1 2 0.9
96X15 3 0.1 0.5
change to this format
serial_no (these two columns will have new headings)
95x45 100 1
95x45 500 2
95x45 1000 0.9
96x15 100 3
96x15 500 0.1
96x15 1000 0.5
I hope, I have explained it well...
Sonia
View 7 Replies
View Related
Feb 28, 2006
Hi,
I've got two tables in Access. The first contains 300 column headers running from top to bottom, i.e:
Title
First Name
Surname
..
..
The second table contains the corresponding data entries for 1000 customers running from left to right, i.e:
MR Trevor Smith ....
MRS Mary Jones ....
Ideally i'd like to append table 2 to the bottom ot table 1 so the correct data field is under the right column header but I can't do this. Is there a transpose style funtion in access which will mean I can convert table 1 to run from left to right instead of top to bottom?
Thanks
J7
View 1 Replies
View Related
Apr 15, 2008
Hi there
Sorry if this a stupid question that has beeen asked loads of times but all the threads of seem always seem to be trying to do the opposite of what i need to do. Im not sure transpose is the right word
I have a table with four rows
Color
------
red
orange
green
blue
and i would like to transform the data as the following in a query
color1 color2 color3 color4
----- ---- ----- ------
red orange green blue
Is this possible with a query?
Thanks
lpj
View 3 Replies
View Related
Feb 21, 2012
My task is to allocate Tasks to People for any/every day of a single week. There are up to 100 different tasks and about 1000 people to choose from but a typical allocation would involve perhaps 200 people. I have successfully used a form that presents a persons Name at the top of the form, and shows, for each Day: whether they are available, a combo box to select Tasks from a predefined list and a Time when they should start the Task. A report easily prints this by Name, without any transposition, and it is great for each person to see Task they have to do on which day and the time they should turn up. However, when it comes to supervision on each day, the manager wants to see a layout with column headings Task, Time1, Day1, Time2, Day2, . . . Time7,Day7 with a list of Tasks with assiciated Names for each of the days. One of the threads presents a solution that uses Dlookup to fetch the data but I believe that worked because the size of the data was determinate.
I have had to create a cludge using a subform/table to store the data as Task, Day1Name, Day1Time etc, using some VB routines, but the user has to take great care, for instance when a person is allocated a different task, the user has first to select a different line on this second table. It is even worse when the allotted task has to change or is deleted. The info is bound to be inconsistent.To sum up, there are only 7 days, not a perpetual calendar, but tasks and people are many and varied.
View 12 Replies
View Related
Dec 18, 2007
I have a table with 8 columns titled - Destination, Mon, Tues, Wed …to.. Sun. This is shown as "OriginalTable" worksheet in the attached example workbook. I want to create a new table from this original table that looks like "NewlTable" worksheet in the attached example. So I will have a new table that has 3 columns titled - Destination, Day, Weight. Weekdays will become rows so each destination will have 7 rows, one for each day of the week. The measure will be listed against each day of the week. Can someone please look at the attached example for me and help me with this.
Many thanks in advance.
View 2 Replies
View Related
Jun 18, 2013
Is there a way to create a query that will transpose table columns into rows:
Genes Cytoband
xxxx yyyyyy
xxx yyyyyy
xxx yyyyyy
xxxxxx yyyyyy
xxxx yyyyyy
xxxxxxx yyyyyyy
xxxxxxx yyyyy
xxx yyyyyy
xxxx yyyyy
xxxxxxx yyyyyyy
xxxx yyyy
xxxxxx yyyyyy
xxxx yyyyyy
xxxxxxx yyyyyy
Is there a way to display the table in a single row separated by commas:
xxxx yyyyy, xxxx yyyyyyy, xxxxxxx yyyyyyyy, xxxxx yyyyyyy
View 11 Replies
View Related
May 25, 2013
I have a Volunteer Database that has teams. There is only one team leader but some of the teams have two or three assistants. Currently I have a query that lists all the assistants for each team vertically.What I want to do is list the Assistants horizontally under headings like Assistant 1; Assistant 2; and Assistant 3 for each team on one line.
View 6 Replies
View Related
Mar 14, 2014
I wanna extract a variable count of columns and transpose it to another table.
My source table is called FC containing columns like 1 FC, 2 FC .., 12 FC
My target table is called Forecast_Quantities
Tried the following:
Code:
Public Sub TRANSPOSE()
Dim rs As DAO.Recordset
Dim rsNew As DAO.Recordset
Dim varItm As Variant
Dim I As Integer
Set rs = CurrentDb.OpenRecordset("FC")
[Code] ....
Somehow it doesn't recognize the I FC column in the table FC.
View 1 Replies
View Related
Jun 5, 2013
Query of daily activities spent hours
1) to be group as weekly total
2) then need to transpose it for reporting.
My table fields are Date, SpentHrs and Code (activity code description).
View 11 Replies
View Related
Oct 19, 2004
What is the best way to impliment a query in a form so that the user can view the query records, and have the option to print or save the selected record using command buttons?
I tried subforms but I could not get the command buttons to work in the subform after it went into the form, it wanted to print the entire form instead of the selected record from the subform.
So in a nutshell I have 3-4 queries that are built, and I want to have them show up on my form in a format that the user can scroll through the results and select a single record of the results and then print or save that individual record from the form, if such a thing is possible.
Thanks in advance
Todd
View 1 Replies
View Related
Mar 24, 2013
I am trying to do the good 'ol sales report (query) to include customers with no sales.
I have a customers table, account number table, sales table & sales (line) detail table. (all linked in that order)
If I run a query to show customers (in the customer table) with account numbers, that works
An unmatched query to show customer without an account number works (but of course the unmatched account number field isn't shown).
How can I get the two two be shown together with the "unmatched" having a null or 0 for their account number?
I am guessing in principle, the resulting solution can be modified to show customers without sales alongside those with sales?
View 3 Replies
View Related
Mar 4, 2015
In some cases I create pass-through queries and use these in an Append or Make-table query to bring data locally.
All is well and fine until source data changes and the pass-through query runs too long and times out.
If needed, I can extend the timeout value in the Parameters of the pass-through query no problem, but when I try to open the Append or Make-table query in Design view to do the same, the pass-through query is first triggered and then throws the timeout, and I cannot access the Design view of the Append or Make-table
Is there a way to open an Append or Make-table query in Design view without invoking the source query?
View 1 Replies
View Related
Oct 28, 2005
Hello All,
I'm trying to run a UNION query that joins five queries through a MS WorkSpace into a DAO.recordset in VB. I'm pulling the data from a SQL Server Database through VB in Access. I'm attempting to open a recordset with a query passed to it as a string. The query is below. For some reason, I'm receiving a message: "MS Jet database engine cannot find the input table or query. Runtime Error 3078".
Here's what's puzzling. When I run a single query without any UNION statement, the code finds the table and runs fine without error, but anytime I join two or more queries with a UNION statement in the VB, it gives me the error.
I've executed the same UNION query in both Access Query Builder and SQL Server's Query Analyzer and they work fine in both environments. It's only when I call the query from a DAO.Recodset with VB that it causes this problem. The following is a sample of the UNION query joining two of the five queries. Does anyone have any idea what could be the problem? The following query executes in about 5 seconds so I don't think there's a "time-out" issue. I'm thinking that the UNION statement may be the culprit. Maybe there's another way to approach joining these separate queries? Any help would be most appreciated. Thanks.
SELECT SalespersonID, Sum([SlsPrice]-[RtnPrice]-[SlsDiscnt]+[RtnDiscnt]) AS fldPrice FROM MyTable WHERE (((Source)='d') AND ((DistrictID)='01') AND ((CategoryID) = 'HCPROD') AND ((BrandID)<>'CSS')) AND (((BrandID)<>'1356')) AND (((BrandID)<>'1400')) AND (((BrandID)<>'1551')) AND (((BrandID)<>'555')) AND (((BrandID)<>'66'))
AND (TransDate >= 07/01/2005) AND (TransDate <= 07/31/2005) GROUP BY SalespersonID
UNION
SELECT SalespersonID, Sum([SlsPrice]-[RtnPrice]-[SlsDiscnt]+[RtnDiscnt]) AS fldPrice FROM MyTable WHERE (((Source)='d') AND ((DistrictID)='01') AND ((ProductID) = '0029800')) AND (TransDate >= 07/01/2005) AND (TransDate <= 07/31/2005) GROUP BY SalespersonID
Set wrkJet = CreateWorkspace("", "pw", "", dbUseJet)
Set db = wrkJet.OpenDatabase("DW", _
dbDriverNoPrompt, True, _
"ODBC;DATABASE=DW;DSN=DW2")
'Set rs1 = db.OpenRecordset(strSQL)
View 9 Replies
View Related
Nov 20, 2013
I am wondering if there is a quicker way to export a query to excel then have the data in that query removed from the original table. (effectively cutting the data from the table and exporting to excel)
I understand that this can be done by exporting the query to excel then running the same query as a delete query to remove the data but I just wondered if this is the most efficient way.
I have experience of VB in excel but currently only use the basic macro builder in Access though if Access VB is more efficient I can easily learn.
View 5 Replies
View Related
Apr 2, 2013
I run a physical therapy office and patients come in for treatment either 3, 4 or 5 times per week. My database is used to track these frequencies (among other things).
I have 3 queries which count how many patients come in 5, 4 and 3 times/week.
In my main table I have fields called "how many 5's", "how many 4's" and "how many 3's".
I have tried to design an update query which will update those fileds in my main table to reflect the counts in the 3 queries mentioned above.
(I'm not using SQL view, I'm using the query design view)
In the "update to:" row, I use the Build function and locate the count I'm looking for.
Problem: when I run the query I get the error: Operation must use an updateable query.
View 3 Replies
View Related
Aug 12, 2015
I have a query where these are the fields:
ProductRevType
RevLag
RevFlowThru
CloseMoYr
ProjRevDate
CurrentMRC
ProjRevMRC
The ProjRevMRC field is an expression that reads:ProjRevMRC: IIf([ProjRevDate]>=DateSerial(Year(Date()),Month(Date()),1),[CurrentMRC]*[qry303a_ SFADetailMRC_ONLY]![Rev Flow Through],0)
When I run the query, it works perfectly, but when I created a crosstab query to show totals by month, I wanted the totals to be zero for the months less than the current month. Is there a way for the crosstab query to execute the expression and put zeroes for those months?
View 4 Replies
View Related
Jul 15, 2014
I have a field that is giving me the number of business days between a period of time and then I want to subtract that number - the person's PTO time to see the actual days they were available...when I simply type the number in (see below) it works great but I want to set up a prompt that will ask me how many PTO Days to calculate as it will be different for each person I am quering...is this possible?
View 9 Replies
View Related
Jul 23, 2015
I have a form which will be used as the basis to print a label.
It is bound to a query and when I open the form I pass over a 'where' condition to return 1 record. I then use the query to produce a report/label.
What I want to do is to update the form/query without updating the underlying tables to the query.
View 14 Replies
View Related
May 31, 2006
:confused:
I am trying to help someone with a complex problem (so it seems to me) but I will first ask about what should be a simple thing....
First goal: to COUNT the number of times a TYPE of visit is made.
There are several different TYPEs but only interested in tracking 2 of them.
When a crosstab query is created - if one of the 2 parameters are not "met", a blank is returned. I have been reading posts about using NZ and IIf IsNull, etc to get past that - but none of them make any sense to me and the Access help suggestions do not work. Hope someone can make it clear with this information: (can't give more specifics to keep privacy intact)
The SQL was written by Access not by me. :)
Here is an example of the Crosstab SQL (which is using a previous query):
TRANSFORM Count([qryTest2.TYPE]) AS CountOfTYPE
SELECT qryTest2.CID
FROM qryTest2
GROUP BY qryTest2.CID
PIVOT qryTest2.TYPE;
-----------
qryTest2 SQL: (Grouping by to remove dups)
SELECT DISTINCTROW tblM.CID, tblM.[M#], tblM.LNAME, tblM.FNAME, tblM.YMDBIRTH, tblC.ClDOS, tblC.TYPE
FROM tblM LEFT JOIN tblC ON tblM.[M#] = tblC.[M#]
GROUP BY tblM.CID, tblM.[M#], tblM.LNAME, tblM.FNAME, tblM.YMDBIRTH, tblC.ClDOS, tblC.TYPE
HAVING (((tblC.TYPE)="Out" Or (tblC.TYPE)="In"))
ORDER BY tblM.CID, tblM.LNAME, tblM.FNAME;
Thanks for you time! :)
View 1 Replies
View Related
Mar 8, 2005
I'm building a report for annual software license renewals. The report data source is a query that combines the customer information, their computer information, and the licenses purchased for that computer. I am having no trouble with the form displaying the customer info page, then a page with the computer info at the top and a list of licenses purchased for that computer underneath.
That would be great, if that's what my boss wanted. However, she wants the whole list of available licenses displayed on each page, in the event someone want to purchase additional licenses with this year's renewal.
I'm trying to figure out how I can set up a query/report grouping to do that. I've tried making a new query, relating the qryLicense!licenseID to the qryPurchase!purchLicense and setting the relationship option to show all records from qryLicense and only those related from qryPurchase. I added the qryPurchase!purchCPU field to my query, hidden it, and set the criteria to “=1” (the computer ID of one of my dummy computer records). I also have a Sum of the qryPurchase!purchQty field included in the new query that I want to display the total number of that particular license purchased (and 0 if there are no corresponding records). All fields except for the quantity field are set to Group By.
What I’m getting from this is simply a list of the licenses purchased for that computer, not the complete list of licenses available showing the quantity purchased where applicable.
Can someone see where I’m going wrong?
Slaughter
slaughter at mizzou dot edu
View 9 Replies
View Related