I have a field that contains a persons full name and at the end of their name in brackets either (S) or (NS).
I have created a new field that will contains the numbers 0 for S & 1 for NS.
How would I run a query that..
A. checks to see what the letter in the bracket is and then puts the correct number into the new field.
B. Automatically deletes the (S) or (NS) after adding it to the field
I have got a query that updates details from one table2 to table1, "Reference" is the primary key and this is what the query uses to determine which need updating.
It all works great but if table2 contains a record in "Reference" that is not in table1 i just want it to ignore it, currently it just seeems to add them.
Ok, i have a question about update queries.I have two tables (I'll call table 1 and table two for simplicity) and an update query. I want to get some data from table one to table two (via an update query). But in table two there is a field that isn't in table one but i want to add a value to that field via the query.My question is, can i manually put into the query what data to add to a field instead of/aswell as using data from other tables.I hope you understood my questions.Cheers
I am trying to remove random characters from a field. The field [assycode] contains a string similar to say, FGEJBF1 or ABFGYRUKC I want to remove any occurrence of "F1" normally at the end of the string but not always at the end. I used: Like "*f1*" to find the correct records, that worked fine, I then used [Assycode]-" f1" in the update to box, It wants to update 146 records I click ok then it says It couldn't due to a type conversion error. Just messing around I tried adding "F1" to these records using [Assycode]+" f1" and it worked fine. Can anyone point me in the right direction?
I have a database where two tables contain information that I need to update based on the 4 right most digits of a field. There are only 11 values that will need to be updated out of a large list of values. I'm not quite sure how to set up the update query so that I can do this.
I have two tables, each has a "status" for a project. In the left table there is only one instance of each set, but in the right hand table, each set may be used more than once by different Projects.
I need the Status field of the left table to be set to "Assigned" if ANY of the sets assigned to projects in the right hand table are "Assinged"
Here is the update query I have setup but when it runs, it updates "0" rows.
8 is the id for the status "Assigned" in the SetStatus table 2 is the id for the status "Assigned" in the Status table. http://img166.imageshack.us/img166/8181/temtinv00210fp.jpg (http://imageshack.us)
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.
As an Access novice I am trying to do a simple update of a table but keep getting an annoying error:
I have 2 tables - Products and OrderDetails
Products ProductID Description StockQuantity
OrderDetails OrderID ProductID Quantity
Basically I want to update the Products.StockQuantity column to subtract the sum of all orders in the OrderDetails table.
So if Product A started with a StockQuantity of 5, and there are 3 Order_Details record, each with a quantity of 2, the query should update the Products.StockQuantity record to -1.
I have tried a few permutations such as:
UPDATE PRODUCTS set PRODUCTS.StockQuantity = PRODUCTS.StockQuantity - ( SELECT SUM(OrderDetails.Quantity) FROM ORDERDETAILS WHERE ORDERDETAILS.ProductID = PRODUCTS.ProductID);
but I seem to keep getting the following error: "Operation must use an updateable query"
Okay I have two tables in a query.tblMain and tblStatestblStates has a control number and a state name.tblMain has the same control number as well as a bunch of customer info.The query is simply tblMain.* and then the state name from tblStates.It pulls the information correctly when I link the control number. However, I cannot update the information.If it just has the tblMain table in the query then I can update everything. As soon as I add the tblStates I can't update anything, even if I don't link the two together. Can someone help me figure out what is going on?The reason I have to have a seperate table is that this is for pulling a contracted state which can be different than the customers state, and the only way it is listed in our system is by number so it has to use this number as a reference and then pull up the state name.
Is it possible to create an update query where the Update To field is set to the results of a previous query? I've been playing around with the Design View but I haven't figured out how to do this yet.
I am using an update query however when clicking on the run button within the query, i keep reciving an error message which i have attached. It basically refering that due to setting a primary Key on the table i cannot add all the records, however i need to set a primary key to the table to stop duplicate entries from being updated. Any help im confused.
The table is set up as: Line Number (Primary Key) WorkOrderNumber (Primary Key) ProdNo (Primary Key) ProductDescription Quantity CylinderSerial Number Status
I have set the first three fields as primary keys as there cannot be a Workorder number with the same line number and product number as another
for e.g. the follwing results cannot be shown Workorder number Line Number ProdNo 3333 1 221 3333 1 221
For e.g the follwing results can be shown
Workorder number Line Number ProdNo 3333 1 221 3333 2 221
I have a Select Query that counts the number of occurance. I would like to update a field in the table (or a different table) with the numbers returned by the count. I have attached a snapshot of my select query (query.jpg). Is this possible?
I have a table with policy numbers (polno) which are in the format of "ABC 123456789" How do I create an update query to remove the ABC at the front of the policy number
I tried this but it didnt work UPDATE [Renewal MI] SET [Renewal MI].polno = "polno" WHERE ((([Renewal MI].polno)=Right([polno],9)));
Is it possible to run an update query which is part of another database?
I have an update query that I would like to run but it's in a different database than the current one. I know I can import queries etc but I just need to run it as it updates tables in that database.
I don't think I'm being clear but if anyone can help me I'd appreciate it
Hi, I have an update query which when run will update a stock field. The problem I'm having is only one record is getting updated. Here's my code: Private Sub cmdReceive_Click() If Me.PORec.Value = False Then DoCmd.SetWarnings False DoCmd.OpenQuery "qryUpdateStockRec", acViewNormal, acEdit DoCmd.SetWarnings True Me.PORec.Value = True Else MsgBox "This purchase order has already been received. If you need to adjust stock please do so by going to Database Maintenance."
End If
End Sub
The update query is looking at the PartID in a subform. There are 3 records in this subform and only the first record gets updated. Thanks
hi, I Have a tabel with this fields ( Name , Compagny , Phone) in The Phone all phone numbers are like this follows +9613430619 And i need to change all records ( 6000 Record) To replace the 3 with 71 so any one can help how i can do this
i did user this update query UPDATE Contacts SET Contacts.MobilePhone = "+%%%71*" WHERE (((Contacts.MobilePhone) Like "+%%%3*")) ;
but the result 0 record will change when i replace -- "+%%%71*" -- With "+96171*" and -- "+%%%3*" --- with "+9613*" it replace all the records but the number +9613430619 replace with +9613*
This ones has me really confused, I hope I explain it ok...
I have a form which is filtered by numerous combo boxes. A 'Compare' field (yes/no) allows the user to add the data to a query that is used as the RecordSource for a comparison report.
On the form is a 'Select All' button which runs an update query to set the 'Compare' field to true for every field that matches the criteria in the combo boxes (and where Compare = False).
This has worked brilliantly until the most recent field that I've added. I created a seperate query which counts the records in another table (linked by the main table's primary key; 1:M). The results are included in the main query so that I can filter the results by that.
This Counting field has been added as a criteria of the update query because this is necessary for 'Select All' to select the values in the current view/filter. When I click 'Select All' however the message reads "Operation must use an updateable query". :confused:
I guess it's a refential integrity problem or something (the PK fields are joined only by a general/standard relationship - have changed this in query view with no success). Searching this error message on the web brings up stuff about servers and the like and I'm only developing this db locally.
I've tried writing an SQL subquery with no success and think it would result in the same error anyway
Any suggestions as to the cause/solution of the problem?
Hi, I have a table with 12 columns (table_a), I want to update the records in table_a with 12 records that are returned from a query on table_b, so that a record that matches a specific criteria from the qrytable_b goes into column 1 on table_a, another record that matches certain criteria from qrytable_b goes into column2, etc etc. There will always be 12 records going into the 12 columns but the values change every month.
Is there a way to do this?
Any help would be greatly appreciated. table_a LargeDirect Number LargeMetro Number LargeCountry Number SmallDirect Number etc for a total 12 columns with different name
Data returned in the query is in the following format:
qryTable_b Column1 Column2 47 Large Direct 85 Small Direct 75 Residue
It is the data in column 1 I want to move in to table_a so I only have 1 record in table_a containing all the totals in table_b.
I'm trying to create what I believe should be a simple update query, but I'm having some difficulties. What I'm trying to do is copy a value from one row in a table to another row in the same table. Here's an example of the syntax that I used...
UPDATE Table1 SET Field1 = (SELECT Field1 FROM Table1 WHERE Field2 = 1) WHERE Field2 = 2
Can anyone tell me what I'm doing wrong here? Thanks.
I have three columns TU, EFX, XPN a fourth column FICO which is based on the values in TU, EX and XPN. I need to update the FICO column so that it is either MEDIAN of TU, EFX, XPN or Minimum of TU, EFX Minimum of TU,XPN, Minimum of XPN, EFX
I expected the SQL statement to be something like
UPDATE Table SET FICO =MED(TU, EFX,XPN)
UPDATE Table SET FICO =MIN(TU, EFX)
UPDATE Table SET FICO =MIN(TU, XPN)
UPDATE Table SET FICO =MIN(XPN, EFX)
Unfortunatelly,these wont work. I'm using Access 97
I have a table named 'Main' on a laptop. I have the same database on our server, meaning that database has the same table named 'Main'. Users will use a laptop and enter data in it over night and I want the user to then upload the data to the database on the server.
In this 'Main' table is a field called 'uploaded' that is a yes/no field. If that record has been uploaded to the server it is marked yes. I was using an append query that would append all of the records where the 'uploaded' field were "no" to the table located on the server. This works fine.
Now I want to change it so that if a user modifies a record that has been uploaded the field 'uploaded' would be changed to "no" (which I can do) and then update the record in the table on the server without creating duplicate records.
There is no single unique key in the table. The reason is becuase we have mulitple laptops upload to the same master database on the server. In order to identify duplicate records I match 'datecreated', 'timecreated', and 'manager' fields.
I am an Access novice and I cannot figure out how do the following: Table_1 contains email addresses. Table_2 contains email addresses and zip codes. I would like to add the zip codes from Table_2 to any matching email addresses in Table_1. It is imperative that no new email addresses be added to Table_1, just zip codes.
I'm not really sure what I need to do. Do I need to run an update query, and if so, what is the best way to do that?
I need to be able to update all the date records in a table using an update query. Any ideas of what i have to put in the 'update to' box to get all the dates to change from dd/mm/2005 to be dd/mm/2006