Modules & VBA :: How To Manipulate Data Export In Rows To Become In Columns
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 Replies
ADVERTISEMENT
Aug 16, 2011
manipulate the data by changing one of the columns (Customer 1) to a Look Up Field. This has created two challenges for myself:
1) The data is gone ... oops. I can solve this one.
2) More serious, that column (Customer 1) will only display primary key numbers of the data. Before the corruption, I had a combo box on a form. This combo box took its values from a Table called CustomerTable, the value in this combo box was stored in the QuoteListTable. Before it showed names, now only primary key.
I have attempted to:
-change the look-up back to a regular field (got rid of the look-up)
-exported the table to a query, turned it back into a table, no change.
View 1 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
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 13, 2014
Access file attachment in the form below if you want to add two columns (like other columns with the capability to filter).
Link file attachment : [URL] ....
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
Jun 25, 2013
I have 2 tables and 1 query. Table dbo_RepOrderItem includes columns:
RepId
OrderNumber
Item
ShipDate
SerialCardID
Table tbl_LBP Sales Location Num includes columns:
Location ID
Rep Region Code
What I've been doing so far through my code is working through a query 'CalculateTotal' which looks up a structure number (Which I enter through an InputBox) from table dbo_RoicStructure, gets the SerialCardID from the same table and collects the associated RepId,OrderNumber,ShipDate from table dbo_RepOrderItem and checks that the OrderNumber(s) returned exist in column Location ID in table tbl_LBP Sales Location Num. It also checks that Rep Region Code is not equal to 'INT' nor 'inte'.
My code for all of this works just fine. What I am trying to do now is simplify my results. I want to only return rows that do not have the same Item, OrderNumber, and RepID.
Fore example:
OrderNumber: Item: RepID:
11 3 1
12 3 1
11 4 1
11 3 1
14 7 4
16 8 8
It would now count 5 existing RepID(s) rather than 6 because it would have deleted the duplicated row. This should only be deleted in the user's table not the actual table.
And speaking of the user's table. What I have been doing so far is only returning the results (right now it returns 6, which as I explained above is incorrect) but I also want to return a table or query that would should the user the work behind the returned number.
This is my code:
Option Compare Database
Option Explicit
Sub SearchPartNumber_Entered()
Dim txtPartNumber As Variant
Dim rst As Recordset
Dim rstt As Recordset
Dim u As Variant
[Code] ....
View 10 Replies
View Related
Dec 30, 2014
Is there any way to 'Export' the selected column (user selected columns) as CSV. I have attached a mockup (screenshot) that gives a clear thought about the scenario. The 'User' will be able to select the 'Columns' for the export of 'tblInventory' and by clicking 'Export as CSV' button will export the 'Selected' columns as CSV.
View 1 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
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 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
Jul 18, 2013
Im trying to export a query to specific columns in excel and im using this code.
Code:
Dim objXL As Object
Dim xlWB As Object
Dim xlWS As Object
[Code].....
I tried it on other querys and it works but doesn't work on this specific one. I get an error on the "set rst = currentDb" line. And to my knowledge it doesn't work because I have a between two dates filter in it. So when I run it, I get an error saying I have too few parameters, expecting 2.
Also it seems to be exporting the lookup id's not the value when exporting(on the query that it did work on)
View 5 Replies
View Related
Apr 14, 2014
I am using MS Access and Excel 2007. I have a query that I need to export to a specific sheet in excel, and the vba is working great and doing what it should. Problem is, some of the data is being exported as numeric, not as text which is what I need. I have several tables related to one another and the fields that were created with the LookUp Wizard and the ones that are not exporting property. From what I have read online, the data that is being exported is from the bound columns, which are the primary key "ID" fields. I have read online that I need to JOIN tables so that Access knows how to identify the foreign keys, but no matter how I do that, it is still exporting the "ID "fields and not the description.
Here is the SQL that I am trying to export:
SELECT tblSampleNew.*, qryProjectSearch.Company, qryProjectSearch.ProjectName, qryProjectSearch.SampleDate, qryProjectSearch.SubmissionDate, qryProjectSearch.SamplePriority, qryProjectSearch.DueDate
FROM qryProjectSearch INNER JOIN tblSampleNew ON qryProjectSearch.IDNumber = tblSampleNew.IDNumber;
the qryProjectSearch.Company is one of the fields that is exporting incorrectly. I have tried to JOIN it to the original table by adding in this expression to the SQL above:
FROM qryProjectSearch INNER JOIN tblClients ON qryProjectSearch.Company = tblClients.ID
This gives a mismatch error, since one field is text type and the other is number, but even when I adjust that, it is still exporting as numbers and not text.
The annoying thing is that when I go to External Data --> Export to Excel Spreadsheet, every exports as text like I want!
View 6 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
Apr 11, 2006
Please try help!
I want on my form some field to connect to field in other table. I would like, when I open form and insert txtName, verify if in field on other table precede that value, and if exist. If exist then find that recordset and open. But if that field don’t exist, open other form and fill that value.
Set rst = New ADODB.Recordset
With rst
.ActiveConnection = CurrentProject.Connection
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open "Select * from vFizickoLice"
.AddNew
' !DeteJMBG = Me.cmbDeteJMBG
!DetePrezime = Me.txtDetePrezime
!DeteIme = Me.txtDeteIme
.Update
Me.cmbDeteJMBG = !DeteJMBG
End With
View 1 Replies
View Related
Feb 25, 2015
I've nearly cracked where I want to be. I have essentially had to do the core of the back-end in SQL in order to organize the data in a way that actually makes sense to ACCESS.
Following this I now have a table with the following fields
Stock No
SK Code
Free Stock Qty
Stk Qty Pd
Actual Min
Actual Max
Forecast EoM
Forecast +1Month
Forecast +2Month
Essentially this is a stock forecast sheet. It takes into consideration incoming stock and estimated usage to provide an output as a "Forecast" stock level at the end of the forthcoming months.
The next phase of developing this is to allow users to manually change the front end by Group and Part Number with Quantity entry so that it auto updates the Estimated EoM, +1Month or +2Month figures depending on which month figure they are looking at. In addition, this information would need to be retained and ideally stored as individual tables or other .
View 2 Replies
View Related
May 5, 2015
I have some tables need to be imported to Access, which is not well structured. For example:
report
4/05/2014
from SQL server
Name ID Add.....
aaa 111
bbb 222
To be more specific,I have 4 csv files, that need to be imported into Access.
1. I'm building 4 linked tables so users can update the table as needed. Then run queries based on these tables to produce report. But maybe there's a better way? the file name and location might be dymatic, so anything like 'getopenfile' would be easier instead of linked tables?
2. These data need to be clean up first to become a 'database table'. (Delete first 2 rows, delete some columns, remove duplicates etc.) I know how to do them in VBA Excel, but never used Macro in Access before.
View 1 Replies
View Related
Mar 22, 2007
I'm affraid my confusing topic title is an indicator of how confused I am by this. I can't even understand the variables well enough to fully utilize Access Help or the Search function here...
What I have is a database hat has column headers that look something like this:
Customer_Name, Order_Date, Qty_Ord, Unit_Price, Total_Price
What I'm trying to get is a query output that will have
Customer_Name, Total Orders (in Dollars) for January, Total Orders (in Dollars) for February, Total Orders (in Dollars) for March, etc.
I've been able to set it up to SUM for one month, but not multiples.
I know I'm totally lame (for proof read any of my previous posts) but you guys totally bailed me out the other time I asked a lame question.
Thanks in advance!
View 3 Replies
View Related
Sep 22, 2014
I have back-end on LINUX, is there any possibilities to automatic export data to *xml? e.g. every 5 min. Maybe some code in vba which can be connected to system timer?
View 3 Replies
View Related
Sep 17, 2013
I want to Export data by date.
A Inputbox will shows up and then ask for a Special date.
I have a table which has for one ID always a Special date.
Many ID can have the same Special date. So i want to Export all with the same Special date.
I've created the following code. When i enter the date, it doesn't Export anything.
Code:
Dim xlApp As Object 'Excel.Application
Dim xlBook As Object 'Excel.Workbook
Dim xlSheet As Object 'Excel.Worksheet
Dim rst As DAO.Recordset, Rechnungsdatum_Finanzamt As Long, tmpStr As String
[Code] .......
View 14 Replies
View Related
Nov 4, 2013
I use following function to concatenate data from multiple rows into a single row/field. It puts a comma ',' after each concatenate. What I would like it to do more is to put 'and' instead of comma between the last two concatenated words. For example: Now it gives me Value 1 but I want to get Value 2.
Value 1:
FormRegNo CombinedParticipants
DC-190 Political parties, CSOs, community residents
Value 2:
FormRegNo CombinedParticipants
DC-190 Political parties, CSOs and community residents
Function:
Option Compare Database
Option Explicit
Public Function ConcatField(strSQL As String) As String
Dim dbs As Database
Dim rst As DAO.Recordset
Dim strConcat As String
[Code] ....
View 2 Replies
View Related
Feb 27, 2007
Hi all,
Is there a way i can transform through a query or vba?
A | B | C
701 70-6
701 70-7
701 70-9
702 70-1
702 70-3
..... etc
transform it to
701 | 70-6 | 70-7 | 70-9
702 | 70-1 | 70-3
703 ....
Thanks in advance
View 3 Replies
View Related