Updating Multiple Rows In One Update Query Help Please!
Mar 7, 2008
I have one table, I want to update multiple fields in that Table with values.
Currently I have on update query for each update.
So for example
Rows: Commercial Quotes, Cover Notes, Personal Quotes
Will have the values: Yes, No, Yes in them.
I need to update those fields, if they say Yes to Commercial Quotes, Cover Notes or Personal Quotes depending on the field obviously. And blank them out if it says No.
Currently I have 30+ different queries I have to click individually one after the other to update each row.
I was wondering if theres a quicker way of doing this all in one hit.
I have a tiny bit of SQL knowledge.
So one of the queries I've figured out I've converted to SQL but again it only updates one instance...
UPDATE Enabler_Data SET Enabler_Data.[Commercial Quotes] = "Commercial Quotes" WHERE (((Enabler_Data.[Commercial Quotes]) = "YES"));
I tried whacking an OR replacing the ; and repeating that statment replacing Commercial Quotes with Cover Notes but it errored out on me.
This is where I get completely stuck and my meagre knowledge fails me so any help would be useful.
Thanks in advance
Matt
View Replies
ADVERTISEMENT
Nov 1, 2012
I'm running an update query that's based on a select query (that runs some calculations). The update query is updating ALL the rows that should be updated with the information in the select query with data from the final row in the select query, and not on a per ID basis as I think I have it set-up to do. The data looks correct in the update query, but again it's not coming out right.
Here's the SQL for what I've written so far:
UPDATE [Customer_Data Query], Customer_Data INNER JOIN Baseline ON Customer_Data.ID = Baseline.ID SET Baseline.[Unit Hours] = [Customer_Data]![Dur_Days]*[Customer_Data]![Dur_Hours]*[Customer_Data]![Number_Units], Baseline.Availability = [Customer_Data]![Perceived_Avail], Baseline.[Hours Available] = [Customer_Data]![Dur_Days]*[Customer_Data]![Dur_Hours]*[Customer_Data]![Number_Units]*[Customer_Data]![Perceived_Avail],
[Code] ....
I've also tried to force the update to the proper row by adding a criteria based on ID.
Select query, here it is:
SELECT Customer_Data.ID, Customer_Data.Data_Set_Version, Customer_Data.Number_Units, Customer_Data.Perceived_Avail, Customer_Data.MTTR_MTBF, Customer_Data.MT_TR_OR_BF_Hours, Customer_Data.Utilization, Customer_Data.Percent_Scheduled, Customer_Data.Sched_Percent_of_PM, Customer_Data.Sched_PM_Duration, Customer_Data.Sched_CBM_Duration, Customer_Data.Sched_CBM_From_PM, Customer_Data.React_Detect, Customer_Data.React_Rework, Customer_Data.React_False_Alarms,
[Code] ....
View 3 Replies
View Related
Mar 16, 2007
Hi,
Is it possible to update multiple rows in a Table at one time using Update Query?
Ta
Kasey
View 5 Replies
View Related
Jan 7, 2014
I have a table called "Mov" and its columns are:
Code:
Number | Link | Name | Status
1899 | htto://example.com/code1 | code1 | Done
2 | htto://example.com/code23455 | code23455 | Done
3 | htto://example.com/code2343 | code2343 | Done
13500 | htto://example.com/code234cv | code234cv | Deleted
220 | htto://example.com/code234cv | code234cv | Null
400 | htto://example.com/code234cv | code234cv | Null
So I want a way to update Status of my rows according to numbers list. For example I want to update Status column for multiple numbers to become Done .
Simply I want to update "Null status" to become "Done" according to its numbers according to this list
Code:
1234
53
546
767
2135
6657
43
34
Something like this
I tried "update query" but I don't know how to use criteria to solve this problem. In Excel I did that by "conditional formatting duplicates" -with my number list which I wanted to update - Then "sort by highlighted color" then "fill copy" the status with the value...
View 4 Replies
View Related
Apr 15, 2014
I have a table with the following columns: Task, Visa type, time it takes to perform the task. There are several taks that are performed for all visa types. I want to create a form to enter data to the table in which for the field visa type I have a list box that can allow multiple values, however, I do not to create a single line with the task and on visa type all the types of visas selected. I want to create a line for each type of visa with the information introduced.
I don't know if this is possible, the reason for which I want for the form to create several rows depending on the visas types is because then I have a query that sums all the types of visas. Can this be possible? I don't want the people to introduce manually directly to the table the data and also that for the same taks they have to enter manually 50 rows with values. I want it to be more simple and easier.
View 3 Replies
View Related
Oct 11, 2007
I'm a bit in over my head. Unfamiliar with Access macros, I need to write a bunch of them for work, and soon. Unixen I can deal with, largely undocumented convoluted Access macros are something else....
My current problem is: I have a table. The first column has a value in it for almost every row. However, there are six other columns after it. I need to write a macro to automatically delete all of the rows that don't have data in the last six columns. Microsoft Help is, as always, of zero use. The FindRecord feature allows me to use expressions to search, but of course, the help fails to tell me what syntax Access uses.
Oh, and it asks me to select a table from the drop-down list. Can I use wildcards here? Is there a way to get it to automatically open the newest table, or will we have to change the macro accordingly each month?
Most tutorials/guides I'm Googling rather brilliantly repeat the same things the help does, AKA, are useless. (Why do they bother writing them if you're not giving new information...?)
I'd ask about the other various access questions I have, but I can pick them up as I go, this is the most pressing question.
View 2 Replies
View Related
Jun 10, 2013
I have a table where and account could have multiple rows with different data like Applied_Date and Trans_Code, and AMOUNT. The AMOUNT in two of the rows will be a positive and a negative and will be zero each other out. I am trying to create a query that will only return the the rows that do not offset each other. Here is an example of my table:
ACCOUNT CODE APPLIED_DATE AMOUNT
292020 M 5/11/2012 ($33.95)
292020 11 5/14/2012 $33.95
292020 A 5/30/2012 ($33.95)
View 3 Replies
View Related
Oct 28, 2005
I have an update query (see attached jpg), but it is not updating. I am running Office 2000 on Windows XP.
Any ideas on where the error is?
View 3 Replies
View Related
Mar 25, 2013
I have a result for a query made from four different tables for which I would like to refine the result of this query grouping multiple rows into columns.
Attached is a pdf file showing the results being obtained by my query and underneath is how the result would like it be after running the query.
I am currently using Access 2010.
View 5 Replies
View Related
Apr 10, 2014
I have the attached code in a query. It should be bringing back just one row for each record, however, if I have anything in any column other than Call_NUmber_int it brings back multiples if that record.
View 9 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 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
Nov 3, 2005
I created an update query that says it has successfully updated 600 records, but when you go into the table, it has not been updated. I am working with an .mde. Does that make a difference?
I first created a select query to find everyone in TX. Then I changed it to an update query to change all TX to CA. Since it did not update the table, I tried running the update query again and this time it says there are not records to update (since it uppposedly updated my 600 records).
Your help is appreciated.
View 1 Replies
View Related
Aug 24, 2006
Hi
I have imported 8000 records into a table called competency.
the table does not have the emp id, but needs it. I have a table called employee information which has the emp id as the primary key. I want to create a simple update query to copy the emp id (autonumbered primary key) field from the Employees table to the (now blank) emp id field in the competency table.
I created a query in design view, added the two tables
included the fields from Competency, Emp ID, Last Name, First Name and in the update field for Emp id I added this
"copy[tbEmployeeInformation].[empid]" In the criteria field of last name I typed a name and ran the query, it gave me the correct amount of records to update, but when I ran it, it gives the type conversion failure error. I checked the fields and they are the same in both tables (type, length, indexing)
What am I doing wrong?
Marlie
View 6 Replies
View Related
Sep 17, 2014
I have a query that returns numerous rows of data per person per day.
Simplified Example ( ';' used to show columns):
LastName ; Date ; DrillNumber ; Score
Smith ; 18/9/14 ; 0 ; 100
Smith ; 18/9/14 ; 1 ; 150
Smith ; 18/9/14 ; 2 ; 120
Doe ; 18/9/14 ; 0 ; 150
Doe ; 18/9/14 ; 1 ; 150
Doe ; 18/9/14 ; 2 ; 100
etc.
I'm trying to create a report that shows each of the scores per drill in the report per person (Dont worry about the formatting):
Name: Smith
Date: 18/9/14
Drill & Score:
0 - 100
1 - 150
2 - 120
However, when I drag the field lists into the report Im getting a new report entry for each drill eg.
Smith
18/9/14
0 - 100
Smith
18/9/14
1 - 150
etc.
Any way to get all drills to show in the one report entry per person? So all data for Smith is in the one report or report section, and then all the data for Doe.
View 5 Replies
View Related
Jul 1, 2013
I have an Access Database and I want to split up one column into multiple columns. The one column has multiple rows that relate to one person, so for instance I have the following:I am taking information from both tables and I want to create a query but I need to separate out the mother, father, and guardian with the names attached
So from the Child table :
Joe Smith Address Phone
The query that I created is from two tables, the child table and the family table: ( I used the dashes just for it to be easier to read)
------Child Table/PrimaryKey --------Family Table---------------------
First Name--- Last Name--- First Name--- Last Name--- Relationship
Joe ----------------Smith ----------Jane --------Doe-------------Mother
Joe ----------------Smith ----------John---------Smith---------- Father
So in this scenario I need to get the name of the second parent in another column....meaning have all the parents appear on the same line for this child, and each child there after..
So I need it to look like this:
------Child Table/PrimaryKey --------Family Table---------------------
First Name------ Last Name------ First Name------ Last Name------ Relationship------ 2First Name------2Last Name------2Relationship
Joe----------------Smith------------ Jane-------------- Doe------------- Mother-----------John---------------- Smith------------ Father
View 1 Replies
View Related
Dec 17, 2006
Hi,
I am trying to implement an update query per the instructions at http://support.microsoft.com/default.aspx?scid=kb;en-us;127977 to append records from table2 to table1.
I would like to add a criteria here saying update (and append) only records that match the criteria table2.dateofreview <= #12/17/2006#
This does not seem to work. The same query works without this criteria.
To test this, I created just one record in table2 (table1 is blank at this time) and manually entered the dateofreview as 12/17/2006 and tried to execute the query. It is not able to show any records.
Won't this query work *with* a Criteria?
View 1 Replies
View Related
Jun 5, 2007
Good morning to you all.
I have a problem that I thought would be quite simple......
But 3 days later I am still trying.
I have a form which populates a table by one set of users (Simple enough) they can only add records.
I also have another set of users who want to access that table through a similar form but with a couple of added fields.
They will not be able to change anything only add their comments to what they see in the new fields supplied. Once this has been done it cannot be edited ever.
So I made a "Make Table Query" and added 2 new fields to that, so when I clicked on the query it came me the last update from the previous table. Problem was everything that was added in the extra fields were deleted!!!!
I would like to update the 2nd table with items that have been newly added to the first table, leaving all the items on the second table the way they were!!!!!!!
Anyone got any ideas please
View 2 Replies
View Related
Aug 14, 2013
I have a list box whose data is inserted in a table named as "test0" ,now in a macro of vba i want to select all the items in the list box and create there pdf files in a folder at my desired location. So far i have managed to create a pdf file of single item ,but i want to select multiple items at once ,
Code:
SELECT test0.ID, test0.item FROM test0 WHERE (((test0.item)=[ItemNumber]));
So, in this query itemNumber are multiple and i want to create there pdf files at once ..just on a click of one button ?
View 2 Replies
View Related
Feb 19, 2008
I want to count based on 1 (same) field from each of two tables, based on if ID is in "X".
select a.groupid, count(a.id), count(b.id)
from ta a, tb b
where value in ('a','b','c')
group by a.groupid
Thats sort of the psuedocode but Im not getting the right results.
Any help would be appreciated.
View 6 Replies
View Related
Nov 26, 2013
I'm using an UPDATE query to update records in one table (tblMain) from another table (tblTemp)
Here is my SQL :
Quote:
UPDATE [tblMain]
INNER JOIN [tblTemp] ON [tblMain].[MainField1] = [tblTemp].[TempField1]
SET [tblMain].[MainField2] = [tblTemp].[TempField2];
I only want to update the records in tblMain which have a corresponding record in tblTemp (linked by MainField1 / TempField1)
If any record doesn't appear in tblTemp, I want tblMain to retain the existing value for that record.
However, it appears that in such situations, the record in tblMain has it's MainField2 value set to null / ZLS.
I've tried using LEFT JOIN and RIGHT JOIN and also tried WHERE clauses but the result is the same every time.
View 3 Replies
View Related
Sep 11, 2005
Hi Im trying to update a row this is the SQL im using
UPDATE HouseEntry
SET [Date]=(SELECT [Term Dates].Start FROM [Term Dates] WHERE [Term Dates].Term =1)
WHERE
EntryNo=40;
When I run it I get an error saying "Operation Must Be an Updatable Query"
If I physically put it in the date e.g SET [Date]=#09/15/2005# It works
so there must be a problem with my Select Statement.
Any ideas???
Cheers
Bikeboardsurf
View 4 Replies
View Related
Jan 25, 2006
Hello everyone! I am constantly have to change a field, called Product_Code, that resides on multiple tables. To change the field I have to run a series of 9 update queries. I'm looking for a way for all these updates to occur at the press of one button on a form. So I would set my criteria using fields on the form that correspond to the appropriate fields on the query and when I press the button all the updates would occur. My question is what is the best way to go about programming this form and is a form my best option to accomplish my goal. I hope I have explained this thoroughly enough...if not I am more than willing to answer any and all questions in order to get this task automated. Thanks everyone.
View 3 Replies
View Related
Jan 12, 2007
Hello,
Was wondering if there is a way without building individual update queries, to update info in one field that has multiple criteria ?
Basically I need to change/update daily multiple ID numbers to new ID numbers, long story on why this needs to be done but for now I need to do it this way.
Example: 12345 update to ABCDE, 6789 update to FGHI, etc. These ID's are all within the same field in the table.
It works fine running each ID one at a time but was wondering if it is possible to do all these updates within one query or code ?
Thanks for any assistance
View 6 Replies
View Related
Apr 10, 2008
Access2007- Building a query to handle future input...
I run an update query that does what it is supposed to do and gives the proper values.
THEN I add a one more field to the source with the builder using + that has no data in it yet, the query fails and gives blanks, even though one of the fields in the source has data in it.
I would think that the "no data" field would be considered 0.00 value and be added together to the field that has values giving at least the value of the field with values as a result of the query.
Is there a setting somewhere that I need to change so that the no value and the value would be combined? I am using the builder to combine the values in the query.
Thanks.
View 2 Replies
View Related
Aug 13, 2014
I have a table where I have 5 columns, (BatteryL1, BatteryL2, BatteryR1, BatteryR2 and BatterySize).I want to update BatterySize, with a value if any one of the above listed columns contains a specific value using something like 'LIKE' in the query.
For example:
UPDATE Customers
SET BatterySize=13
WHERE BatteryL1 LIKE '%13%'
[code]...
View 3 Replies
View Related