Queries :: SQL UPDATE That Adds But Doesn't Replace?

Aug 27, 2013

Right now, I'm working with an SQL code of

Code:
"UPDATE Individuals SET [ShareholderOf] = " & Me.CompanyNo & " WHERE [Name] = '" & PerName & "';"

However, doing so will obviously change the "Shareholder of" field into what the user inputs (Me.CompanyNo). What should I use if I want it to ADD the user input rather than REPLACING the old [shareholderof] value?

View Replies


ADVERTISEMENT

Queries :: Update Query To Replace Number With Text

Apr 15, 2014

I've made a simple form to Login/Logout with radio buttons but the buttons only allow me to push a number as a value, in my case 1 or 2 for Login or Logout.

How would I make an update query to change those numbers to the equivalent text? Or is that not possible in the same field because that is 2 different data types?

View 5 Replies View Related

Queries :: Update Query To Replace All Data In Field

Apr 8, 2013

Is it possible for an update query to simply replace all the data in a table's field with the results from a query?

For example, I have Table A with the field Years. This table performs various calculations within based on the field Years.

I would like an update query that simply replaces the Years field data in Table A with a new set of years based on a query's search criteria.

When I run the below query, I get an error saying the query must be updateable- but Im not trying to update the query, rather the Table

I've attached a photo ......

View 1 Replies View Related

Possible To Update 180 Queries With Find / Replace Script Or Function?

Apr 2, 2014

The company I work for is consolidating regional server space onto a single server. I have relinked all of my tables, but my ~180 queries are still pointing to the old server.

My question: Is there a script or other process that can be executed that will search through all my queries within the database to find the string "dbo_tbl" and replace with "dbo_vwtbl"? I would very much like to avoid taking each individual query to a notepad...

View 3 Replies View Related

Queries :: Make Replace Query To Look In Order To Find What To Replace

May 6, 2014

I have this working query:

Code:
INSERT INTO TB_SISTEMAS ( LOGIN, SISTEMA, PERFIL, DATA )
SELECT Left([dbo_BACKUP_ACESSOS.LOGIN],255) AS LOGIN, dbo_BACKUP_ACESSOS.SISTEMA, Left([dbo_BACKUP_ACESSOS.PERFIL],255) AS PERFIL, dbo_BACKUP_ACESSOS.DATA
FROM dbo_BACKUP_ACESSOS
WHERE (((dbo_BACKUP_ACESSOS.SISTEMA)<>"ACTIVE DIRECTORY") AND ((dbo_BACKUP_ACESSOS.DATA)="2014-03-23"));

But Iwant to be able to use a set of data to be used in the Replace Statement, so I create a table to add each string I would like to have replaced by "nothing", and trying to make the replace query to look there in order to find what to replace.I also created a table where I will list the systems that I dont want in the select, so I removed the "ACTIVE DIRECTORY" and replaced by the colum that have the list of system I dont want listed.This is the result:

Code:
INSERT INTO TB_SISTEMAS ( LOGIN, SISTEMA, PERFIL, DATA )
SELECT Replace((Left([dbo_BACKUP_ACESSOS.LOGIN],255)),[PREFIXOS_E_SUFIXOS]![Valor],"") AS LOGIN, dbo_BACKUP_ACESSOS.SISTEMA, Left([dbo_BACKUP_ACESSOS.PERFIL],255) AS PERFIL, dbo_BACKUP_ACESSOS.DATA
FROM dbo_BACKUP_ACESSOS
WHERE (((dbo_BACKUP_ACESSOS.SISTEMA)<>[SISTEMAS_EXCLUIDOS]![Sistema]) AND ((dbo_BACKUP_ACESSOS.DATA)="2014-03-23"));

The thin is that this keeps asking me to enter the parameter value for "PREFIXOS_E_SUFIXOS!Valor" and for "SISTEMAS_EXCLUIDOS!Sistema"

View 6 Replies View Related

Queries :: Append Query / Adds Records - Despite Key Violation?

Dec 3, 2013

- I have a module which runs queries on linked sales spreadsheets, to merge them in to one Access table.
- To prevent duplication of sales, the primary key merges the sales record and item number fields.

Today, it's found 103 key duplication errors, which is fine. But it's still adding data to the table. The data seems to be fields which aren't even mentioned in the query. It only does this when the query is ran from VBA.

Code:
MergeEbay = "INSERT INTO tblSales ( SalesRecord, SKU, PostCode, Shipping, Quantity, SalePrice, SalesRecordSKU, DateAdded )" & _
"SELECT exEbaySales.[Sales record number], IIf(exEbaySales.[Custom label] Is Null,'0',exEbaySales.[Custom label]), exEbaySales.[Buyer postcode], " & _

[code]...

View 3 Replies View Related

Queries :: Make Table Query That Adds A Primary Key

Aug 8, 2013

I have a make table query that gets its info from another table that is updated weekly. I would like that when we run the Query Type (Make Table), we would like to add a primary key to a field that exists already starting at 1 every time the query is run.

View 3 Replies View Related

Update Table To Replace Primary Key

Mar 8, 2007

My database tracks all of the staff development sessions provided for the past ten years, thus we have thousands of records. Our school district wants all departments to move away from using an employee's Social Security number to a number assigned by the district. Each employee has been assigned a unique six digit number.

In my staff development database, the employees data (Social Security number, campus, job description, etc.) are in a table, "EmployeesTbl", with the primary key being the Social Security Number. Classes data are in a table, "ClassesTbl" with some of the fields being ClassNum (an autonumber), class name, class description, etc., with the ClassNum being the primary key
in this table.

A third table, "AttendTbl", links the two and shows each class (staff development session) each employee has taken. This table has a a foreign key, "SocNum", that links it to the EmployeesTbl, and another foreign key, "ClassNum", that links it to the ClassesTbl.

I have added the EmpNum field to the EmployeesTbl, and all of the the district assigned employees' numbers have been entered. I have also added this field to the AttendTbl. Is there a means of using a query to fill in the employees number in this table. Is so, I'll then change the primary key in the EmployeesTbl to be the employee number and the foreign key in the AttendTbl to be the same. If not, we face the task of having to key in 18,000 records!

Thanks for any help,
R. Sanders

View 14 Replies View Related

Db Doesn´t Update

May 31, 2006

Hi, I have a db that has worked perfect with multiple users.
Now, the db doesnt show the updates made by different users.
How can this happen?

Jack

View 1 Replies View Related

Update Query - Replace Function Problem

Oct 31, 2004

I'm having problems with an assignment in an online course I am taking.

The assignment is to create one Update Query to find & remove typos in a field. Specifically, the typos are multiple f's & g's embedded in a field.

I created an Update Query that finds the typos & removes just the f's. I'm having trouble with the syntax to also remove the g's.

This is what I have so far that works great.

Update: Replace([Field2],"fff","")
Criteria: Like “*fff*”
or: Like “*ggg*”

The Query finds the records that contain both the "fff" & the "ggg" typos but I'm having trouble with Syntax for removing both.

Does anyone know what I have to change in the "Update:" line to include removing the g's?

I know I could easily create 2 Querys to remove the f's then the g's but the assignment requires only 1 Query to remove both.

Thanks,
Yaani-Mai

View 5 Replies View Related

General :: Update Query To Replace Letters And Digits

Feb 27, 2015

We have a field of 7m records of varying length, some of which are numbers, some just letters, some alphanumeric, and most which include a dash, space or some sort of punctuation mark.

We need to replace all letters with "L", then replace all digits with "@".

We can replace characters individually using this update query:

Replace([Ref Digit Or Letter],"A","L")

But would like to use wildcard searches to resolve this, something like (these don't work!)...

Replace([Ref Digit Or Letter],"A-Z","L")
Replace([Ref Digit Or Letter],"LIKE [*A-Z*]","L")

View 13 Replies View Related

Combo Box Doesn't Update Fields

Feb 27, 2008

I have a Combobox so the enduser can search and select items for the form below it rather than clicking the arrows for Next/Previous.However I have an issue with DLookup queries.My Combobox is called 'F_ComboBox' (I use F_ in my forms to indicate it's a form textfield and not from a table).My first field in the form, called 'F_ProdID', I want it to select the rows ID from the Combobox option selected. So it's simply:=[F_ComboBox]Which works fine, it shows the ID for what I selected... but when I do this to show my ProductName...=DLookup([ProductName], 'Products', [ProdID] = [F_ComboBox])Or the same but using the first textfield:=DLookup([ProductName], 'Products', [ProdID] = [F_ProdID])It loads once but if I select another item out of the Combobox it doesn't change, it just stays on the last result. So the query works, just doesn't refresh when a new item is picked from the ComboBox.Am I doing something wrong?Thanks,Nick.

View 1 Replies View Related

Combo Box Selection Doesn't Update

Jan 17, 2014

I have a combo box on a form with claim #s. When selecting a claim # the appropriate record displays, but when using the record selector to advance to the next record, the combo selection does not update.

View 11 Replies View Related

Update Query Doesn't Select 1 Record

Nov 22, 2006

Upon closing my frmInventory the amount stock of stock is checked against a minimal stock value. If the stock amount is below a set minimal value a subsequent form is opened telling you that stock is low and an email message is generated to notify a manager. I have a checkbox on that form which is set to "True" upon close using an update query. The checkbox is there to give users the option to either send or not send a reminder message that stock is low when a message has already been sent earlier.

The problem is that using that update query ALL records are set to "sent=true" and not just the 1 record I intend.

This is my code in the "on close" event:

DoCmd.OpenQuery "qryUpdateEmailMinimal_True

and here's the SQL:

UPDATE tblInventory SET tblInventory.emailSentMinimal = True;


I assume what is missing is a reference to an inventoryID number. How do I do that?

View 3 Replies View Related

Datasheet For Two Tables - ID Doesn't Update Automatically

Dec 19, 2011

I have this small problem with datasheet:

I have 2 tables. They are connected with ID (Form1.ID=Form2.fID)

Now I made a datasheet of both of them, but the ID doesn't update automatically, how do I fix this?

View 1 Replies View Related

Form Doesn't Always Update When Opened. Is This A Requery Problem?

Apr 11, 2005

Please refer to the attached file. The form of concern is frmAssessmentInput.

Select the appropriate criteria per instructions (in red), including entries on the continuous subform. Then click the "Input data" command button. A 2nd form opens (frmObservations) that contains a textbox labeled DocumentStreamID, and this textbox SHOULD contain the value from the corresponding DocumentStreamID textbox contained in the master form, where you clicked the command button. However, even though the sources are linked properly, the value doesn't pass if you click the command button immediately after adding a new record to the continuous form; it only passes if 1) the master form is closed and reopened first, or 2) if you close the 2nd form, toggle to design view and back to form view for the master form, and then click the "Input data" button again.

What is going on here? Given that the value passes once another procedure is run, do you think this a requery problem? I tried placing a VBA control requery in the 2nd form's On Current and On Load events, but this didn't solve things for me so I took out those event procedures (code could have been wrong though).

View 3 Replies View Related

Forms :: Subform Doesn't Update After Values Being Updated By Another Form

Feb 27, 2015

I'm running into an issue with my forms. I have a form that contains a subform, that contains a list of projects. This list is read-only. To update a record, you can double click on it, which opens another form filtered on this record, and which contains the fields in the first form as well as some others.

I have a command button on that last form to "Save and close", which fires up a macro that saves the record and closes the window.

Now, the issue that I'm having is that, when the window closes and I'm once again in front of the first form with the list of projects, the values of the record I changed are not updated and when I click on another record, Access tells me there's a conflict in the values and asks me if I want to keep the changes, discard them or copy to the clipboard.

It seems to consider the old values from the first form as a change, and thus asks me which to keep between these, and the actual (proper) changes I made in the dedicated form.

For the proper changes to be applied, I need to select "Drop changes".

I tried to requery the first form, also undo the changes to it after closing the window, but none of that worked.

I'm actually basing this on one of the templates, which does exactly what I want and which obviously works...

View 3 Replies View Related

Error - Field Date Update Doesn't Exist In Destination Table

Aug 7, 2013

Was trying to append an Excel 97-2003 spreadsheet to an existing Access 2010 database.

The last field in the spreadsheet is Date Update.

When I click 'Finish' I get the error "Field Date Update doesn't exist in destination table <name of table>.

This database was created in Access 2003, and was not updated since and I don't have Access 2003 on my destop.

I saved the Excel Spread as a Excel Workbook *.xlsx and tried to append it. Same Error was the result.

View 14 Replies View Related

Queries :: Replace Nulls With Zeros?

Aug 13, 2013

In the following simplified query, in some months(MonthOf) there were no warranties so I have a null field for AcceptedWarranties:

SELECT qryWarranty.MonthOf, qryWarranty.AcceptedWarranties
FROM qryWarranty;

In order to make my Warranty Trends graph work I need 0s. Other postings show the following statement should get the results I need:

SELECT ISNULL(AcceptedWarranties, 0 ) FROM qryWarranty

But no matter how I try to work this into the original code, the compiler finds reason to reject it.

View 2 Replies View Related

Queries :: Replace First Occurrence Of A String

Jan 12, 2015

Here are the 2 tables that I am working with:

Account

Account
0041980041
0051670051
0052330052
0053490053

Conversion

Account Conversion
0041 10000151
0051 10000152
0052 10000153
0053 100001524

I need to update the Account table using the Conversion table by replacing the first 4 digits in the Account table with the Conversion value. For example, the first record should be updated from 0041980041 to 10000151980041.

View 4 Replies View Related

Queries :: Replace 2 Characters In String With 0s

Dec 8, 2014

I'm familiar with writing a replace query to replace characters or strings but what I'm trying to do this time is a bit unique to me. I have a string of numbers that will either be 8 or 9 digits in length. The first 1 or 2 digits will be the State code (1-50 hence the discrepancy in number of total digits), then a 2 digit agency code, then the last 5 digits are a producer code. What I need to do is change the 2 digits for the agency part both to 0. So basically characters 6 and 7 if you're counting from the right. To me it feels like I'm trying to do it backwards so I'm having a hard time writing it.

View 12 Replies View Related

Queries :: Replace Null With Currency Zero?

Jul 31, 2013

I have always relied on Design View to create my queries, usually with great success, but in so doing, I have not become familiar with SQL view, so can't solve this problem:

I have a very simple query whose only function is to sum the payment amounts received for each contract number:

SELECT Payments.[Contract Number], Sum(Payments.[Payment Amount]) AS [SumOfPayment Amount]
FROM Payments
GROUP BY Payments.[Contract Number];

It is then used in subsequent queries to create an accounts payable report. It works great as long as at least one payment has been received on the contract, but if NO payments have ever been received, the Sum is actually null, so that record doesn't get included. I need a way for this query to return zero or currency zero 0.00 for all contracts with no payments yet, so those contracts will be included and the next query in line will see a zero.

In my search, it seems I need to make use of the IsNull function in my SQL (the check expression would be the sum of payments, the replacement value would be zero) OR I need to include a WHEN or WHERE in my SELECT statement above? I just don't know enough about SQL to make this happen .

View 8 Replies View Related

Queries :: Trim And Replace Function?

May 31, 2014

I need to remove 1 final - from my string. Here is my sql.

Quote:

SELECT tblmaintenance.sernu, Right([sernu],10) AS m10digit, InStr([m10digit],"-") AS [Space]
FROM tblmaintenance;

View 3 Replies View Related

Queries :: How To Replace A Field With A Different Word Based On Its Value

Mar 15, 2013

I have a seating chart with 33 tables. Under each table there is a number that represents seats taken. I want to do a query that changes the number when it is a certain value. For example, when the value is null I want it to say "Empty", when the value is 10 I want it to say "Full" and when the value is over 10 I want it to say "Over". If the value is 1-9 I want to leave it as is.I know how to accomplish one at a time but not all three together. I've been useing:

Nz([Table#],"Empty")
IIf([Table#]=10,"Full",[Table#])
IIf([Table#]>10,"OVER",[Table#])

[code]....

View 6 Replies View Related

Queries :: Find And Replace Full Records

Apr 24, 2015

I have a table of sales information. Part of my products are kits that are a combination of individual products. (Think of it as a value meal at a fast food restaurant. You can order a hamburger, a soda, and a small french fry separately. But if you get the Value Meal #1 you get all three at a discounted price.)

What I would like to do is make a new table/query that extracts out the kits out of the original sales table and replaces the kit record with records that show the components.

I have attached a file to show as an example of how the records current look and how I would like it to look.

View 8 Replies View Related

Queries :: Replace Function In Query With Sub Table

Feb 14, 2014

I am running a query for an apparel manufacturing facility. In my query I have a table called 'OrderForm' which is where the orders are put in. There are more than one type of fabric that can be a part of an apparel item, so as a result, there are multiple fields pulling from the 'FabricType' table. In order to get this to work in my query I created 'SubTables' for the different fabric fields. For example, I have tblFrontfab, tblbackfab, tblsleevefab, and tblcollarfab which are just extra copies of the 'FabricType' table. The actual question is that when I want to replace characters like ,./& in the fabric field but I can't use the replace function. It says that it is too complex to calculate.

I used this notation
Frontfab: Replace([tblFrontfab].[fabric],".","")
and the error was that it is to complex to evaluate.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved