Replace Function In A Query
Jan 19, 2008
Can the replace function be used in a query?
I have used this
=Replace(Format([SITELATSEC],"00.0"),".",",") in a report and it works fine.
I have the following expression in a query that is output to a report.
LAT: "Latitude: " & [SITELATDEG] & "º " & [SITELATMIN] & "' " & [SITELATSEC] & """ "
I need to be able to display [SITELATSEC] with a comma instead of a decimal point. I tried
LAT: "Latitude: " & [SITELATDEG] & "º " & [SITELATMIN] & "' " & =Replace(Format([SITELATSEC]00.0"),".",",") & """ "
and got an error message about too many commas.
On a more general note: Has anyone ever actually finished a database - ie got to the point where no changes needed to be made? 18 months after this started, and I'm still tryng to accomodate what my manager wants!
View Replies
ADVERTISEMENT
May 16, 2012
How do you use a query for the find and replace function???
View 7 Replies
View Related
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
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
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
Oct 23, 2007
I am trying to use an update query to modify some text in a specific field using the REPLACE function without much luck!!!
I have a field called "Option" and I want to replace the word "Metallic" with "Paint" and the word "Electric" with "Windows".
Could someone please point me in the right direction.
Thanks in anticipation.
View 7 Replies
View Related
Jun 23, 2006
Hi All,
I'm currently migrating a lot of Excel processing to Access and really enjoying the transition. I am, however, having big problems with the Replace function in Access.....
In Excel I use a macro to relace anything in a cell contents that follows a space with nothing......i.e. replace " *" with ""
The fields that i need to do this on do vary in length- they are product descriptors.....e.g
abcdefg 123456
xzy 987
The replace feature (ctrl + h) in table view will do this correctly if "any part of cell" is specified in "match" selection but I cannot seem to replicate this in a query.
I'd be grateful for any suggestions here. I thought about exporting the fields in the columns to Excel and doing the replace there, but I can't get it to work. Similarly I tried writing some VBA for this, but again no joy!
Thanks,
N
View 2 Replies
View Related
Aug 3, 2006
I'm trying to assign a numeric value to different existing text values in a field in Access. Does anyone know the syntax of this?? :) thanks
View 3 Replies
View Related
Jul 12, 2007
I'm trying to help someone with some text functions in Access, and I have used the Replace function to strip out spaces in a postcode. I created a dummy database in Access 2003 but in 2000 format since she is still on Access 2000. However, she is getting the above message. Incidentally, I don't get the message when I run it in Access 2000.
She has checked her references and has no missing ones. She has:
Visual Basic for Applications
Microsoft Access 9.0 Object Library
OLE Automation
Microsoft DAO 3.6 Object Library
Microsoft ActiveX Data Objects 2.5 Library
I have attached the DB - I'd be really grateful if someone could try opening it in Access 2000 to see if they get the same error.
Does anyone have any ideas?
Many thanks
View 12 Replies
View Related
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
Jun 11, 2014
I am trying to use the string value from a form control as the criteria for a query. I first need to replace the "," in the string with "AND".
So far I have a module using the Replace function, but it doesn't seem to be working. I am not sure I can reference the string inside the form control directly....if I can, I might have a syntax error.
Here is my code so far:
Dim result As String
result = Replace("Forms!Processing!Dataset_Acreage_Query", ",", "AND")
I am not experienced and having trouble finding the search terms to answer this question.
View 1 Replies
View Related
Nov 29, 2012
Why I can not change my access field value by find and replace command.
Some time I can change this but some time this is not done and a error come out.
The value you have inserted is not valid...
You tried to commit or rollback a transaction without
View 1 Replies
View Related
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
Apr 25, 2014
I have a list of consumables;
Syringe 50ml
Syringe 20ml
Syringe 5ml
Syringe Cap
White Needle
I want to remove only the number and the ml part from the list, so I would end up with;
Syringe
Syringe
Syringe
Syringe Cap
White Needle
If I use
PHP Code:
Replace([DrugNameVial],"50ml","")Â
I get the desired result for the 50ml syringe size.
I have tried every possible combination of "**ml", "##ml", "Like [0-9]ml all with no success.
How this can be resolved without having to individual enter each syringe size "5ml", "20ml" etc
I can't even just take the text from the right till the first space as this would lead to problems with other consumables in the list.
View 5 Replies
View Related
Dec 3, 2012
Is there a copy and replace existing records function in access?
I.e. I would want to copy records from one table to another (with same structure) and replace similar records with in original table in the new records (which have minor ammendments made).
View 3 Replies
View Related
Aug 4, 2014
My company recently upgraded our MS Office from 2007 to 2010 (except for Access).
Previously, when I had Access 2007 and Outlook 2007, I had a process that generated 50+ dynamic emails from an Outlook template file (.oft).
The code would loop through a listbox and replace the template's default text to a string of text specific to the selection in the listbox by utilizing the Replace() function on the MailItem .HTMLBody.
Since the upgrade to Outlook 2010, the code is able to run, however, the Replace() function is no longer working; Instead, each email that is generated maintains the template's default text.
The only thing that is not working is the Replace() function, all other aspects of the code work fine.
I've provided a simplified version of the code below:
Dim myOlApp As Outlook.Application
Dim objMailMessage As MailItem
Dim stBody As String
Set myOlApp = Outlook.Application
Set objMailMessage = myOlApp.CreateItemFromTemplate("C:UsersDesktop emplate.oft")
[Code] .....
I've recreated the template file in Outlook 2010, thinking that the template created with Outlook 2007 would be the culprit, but to no avail.
What could have changed from Outlook 2007 to Outlook 2010 that would render my previously valid code ineffective?
Are there certain references I need to enable in both Access and Outlook to allow VBA in Access modify the content in an Outlook email?
View 12 Replies
View Related
Dec 14, 2006
Hi Guys,
Need a little bit of help, I have a report I pull out of an inhouse system with sales, shortages etc. I want to use a query to alter the formatting slightly and append it in to a different table. Most of this i can do fine, except for one thing.
Two of the sales fields in my report I'm uploading come out in the following text format:
19.0PC
27.0PC
45.0PC
etc...
I need to change this before appending as its going in to a number field, all i need to do is lose the PC, e.g.
19.0
27.0
45.0
etc...
I can do this manually, it's a simple find and replace in excel before uploading, gowever I want to automate this as much as possible. Looking around I'm pretty sure it can be done in a query using the REPLACE function but I'm unsure on the formats to use.
The only other thing is once its converted even though it will visually be a numbe (e.g. 45.0) it will still technically be a text field, will this prove a problem on the appending?
Many Thanks
Paul
View 1 Replies
View Related
Aug 14, 2007
Hi, i have a table of data, with a user name, and a task.
Each user is assigned many tasks, i and i would like to create a query that replaces all instances of a certain name with another name. How would i do that?
Thanks
Sean
View 1 Replies
View Related
Dec 11, 2013
So basically I need making a function that will count the number of records from another table/query based on a field from the current query.
View 2 Replies
View Related
Jul 6, 2005
Is there a way to edit/replace tables in a query after you've copied the query? Basically, I have created a query and would like to copy the quesry. However, I would like to easily change some of the tables within the query. Is there a way to edit/replace the tables?
Thanks
View 2 Replies
View Related
Jan 9, 2006
Hello.
I have a simple crosstab query, which is designed to give a monthly total (numeric) and a yearly total for the value of orders placed by a number of customers.
The query is based on another query which simply extracts order records for a particular year.
For some customers, certain months will be blank as there were no orders placed.
I would like to use the crosstab query on a report, and I would like to replace the blanks with zeros.
I have searched for examples of query expressions using the nz function and attempted to apply some. I have, however, had no success in converting the blank monthly totals to zeros.
Can anyone help me achieve this?
The query is as follows :
TRANSFORM Sum(AmountQueryLastYear.SumOfAmount) AS SumOfSumOfAmount
SELECT AmountQueryLastYear.DeliveryName, Sum(AmountQueryLastYear.SumOfAmount) AS [Total Of SumOfAmount]
FROM AmountQueryLastYear
GROUP BY AmountQueryLastYear.DeliveryName
PIVOT Format([ShipmentDate],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
An example of expressions I have tried is :
Expr1: NZ([SumOfAmount],0)
In it's own column in the query design grid.
View 7 Replies
View Related
Dec 3, 2007
ne1 help me with a find and replace query or macro. What I'm trying to do is shorten the path to external PDF files after I inport them into field TxtPDFPath.
Example; after inport of files path reads
c:w2kdatapdffiles2005somepdf.pdf
c:w2kdatapdffiles2005januarysomeother.pdf
c:w2kdatapdffiles2006another.pdf
I would like to shorten all imported paths to
pdffileswhatever
Example;
pdffiles2005somepdf.pdf
pdffiles2005januarysomeother.pdf
pdffiles2006another.pdf
and so on
View 13 Replies
View Related
Dec 6, 2013
I would like to replace missing TRP information from Query LF with average TRP information coming from Query LF_Average.
Somehow it doesn't work.
Code:
Public Sub Replace()
Dim strSQL7 As String
Dim qdf7 As QueryDef
strSQL7 = "SELECT LF_QUERY.*, LF_AVERAGE.Average_TRP_EUR " & _
[Code] .....
View 14 Replies
View Related
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
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
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