i have a table that has a column containing a letter reference a / and then another reference ( EG. AAA/A56457A, ght/6577654ghf, etc ) and i want to replace the / with a _
whats the easest and quickest way to do this as an expression
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.
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"
now i want to split it up. i want to count all the records for each month. my field name is datein_now but its just a normal textfield and not a date field. example in field: 05/02/02 10:24:31 AM. also got a datein textfield:05/02/02 i had Count(*) where datein_now between 05/05/01 and 05/05/31
I have tried putting vbcrlf and "NN" as parameters into this but it doesn't work (maybe it can't see vbcrlf as a separate word!)
Function ReplaceWord(strText As String, _ strFind As String, _ strReplace As String) As String
' This function searches a string for a word and replaces it. ' You can use a wildcard mask to specify the search string.
Dim astrText() As String Dim lngCount As Long
' Split the string at specified delimiter. astrText = Split(strText)
' Loop through array, performing comparison ' against wildcard mask. For lngCount = LBound(astrText) To UBound(astrText) If astrText(lngCount) Like strFind Then ' If array element satisfies wildcard search, ' replace it. astrText(lngCount) = strReplace End If Next ' Join string, using same delimiter. ReplaceWord = Join(astrText) End Function
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?
I am currently working on a project where i need to try and compare a list of organisation names held by my organisation and another organisation (around 20000 records each).
To take into account differences in how the organisation names may have been entered I'm wanting to strip out things like ltd, limited, company, co, &, and , and so on. I've tried using IIf and replace which works ok if the organisation name only contains one of the substrings I want to replace but not if contains more than one.
How do i go about doing multiple replaces in the same string?
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?
We do alot of find and replace in our main form (CTRL+F). The glitch is that once the pop-up box for "Find and Replace" appears, we almost always have to change the search setting from "Whole Field" to "Any Part of Field". Is there a way to set the default to "Any Part of Field" instead so that we don't have to change the setting every time?
I have a query where I make a calculation. In some cases this calculation results in a division by zero. The field will then show #Fout (#Error in english?). I want to replace this message with something else, like a dash for example.
I have a combobox called ‘SupplierList’ full of suppliers that the user can choose from. Then I have a listbox called “SupplierQuery’ which is empty. The user will double-click on a name in ‘SupplierList’ to add the suppliers that they want to include in some future query. I have this as the event procedure so far:
Private Sub SupplierList_DblClick(Cancel As Integer)
This works insofar as it adds the double-clicked name to the ‘SupplierQuery’ listbox. But it replaces the previous double-clicked name with the newly double-clicked name each time. How can I make so that it adds each newly dbl-clicked name - forming a list of names in the listbox - instead of replacing the previous entry? If possible, I would like it to get the listed results directly from a table through a query.
having a problem with a query, its used to export data to a txt file for another program.
the problem is i have a field that i format with end of line chars between entries in the field, so in access it looks like a few entries rather than one field (there were reasons for this).
when it comes to export this data, i need to remove the end of line chars with spaces.
heres the part of the query i need to fix: Description: IIf(InStr([Order_data].[Stock2],Chr(13)),Replace([Order_data].[Stock2],Chr(13),Chr(32)) & Replace([Order_data].[Stock2],Chr(10),Chr(32)),[Order_data].[Stock2] & " " & IIf(nz([Order_data].[Stock3])<>"",IIf(InStr([Order_data].[Stock3],Chr(13)),Replace([Order_data].[Stock3],Chr(13),Chr(32)) & Replace([Order_data].[Stock3],Chr(10),Chr(32)),[Order_data].[stock3]),""))
yes that is nasty.. but simple to understand. 2 fields get combined for output (stock2 and stock3), i check first if they need to have chars replaced, then replace if necessary. the output i get though doesnt seem to be replacing the chars, it finds them there with the if however.
I have a list of dates of births in a table, but the way they are always imported (from some piece of crappy software somewhere) is in the format of: 01.01.2005 (using full stops).
Access doesn't like this, and insists on slashes, or dashes. Now, if I do a find/replace, it works perfectly, just replacing all the full stops with slashes. However, I want to do this quite regularly...any ideas how to do it programatically in VBA?
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!
I have my main table and one column is a lookup field to another table.
One of the options that was in the dropdown needed to be changed. So I changed the dropdown, but now I need to change all the old entries to reflect this change.
I opened the main table, and thought I could do a find/replace. But it doesn't work. If I do just a 'find' it finds the old text just fine. But if I do the Find/Replace option, it says the 'look for' text was not found. Even tho, I just found it using the find option. If I click on the tab that says find, it will find it again. If I click on the find/replace it can't find it.
any ideas on a way to quickly replace my text in these fileds, without having to go 1 by 1 through each record.
Hi, My company has renamed a product. I want to find all the records in all the tables in my database that might have the old name, and replace with the new name. What's the easiest way to do this?
I don't really want to have to manually open each table and do a find.
I can write code to go through all the tabledefs and do a find on each one, but the only way I know to do that is by telling it the field name, and field names where the product name might exist vary.
I suppose I can tell it something like for each TD in tabledefs for each F in td.fields {search and replace} next f next t
Is this really the best way? I have a program called SpeedFerret, which I thought would do this, but it apparently only searches the table names, not the actual records in the table.
Hi all! I'm experiencing an apparently simple problem, but it's taking me too long to solve :confused: Two tables with a "text" (100) column on each. I want to select those who are identical. ¡So easy! thats the where clause:
AND a.sDesEntidad = b.sNombreLargo
That works fine. But... i want to "relax" the clause, by not considering dots ( . ) when comparing, and i do like this:
AND (Replace([a]![sDesEntidad],'.','') = Replace([b]![sNombreLargo],'.',''));
and i get a run-time Error 3464, Data type mismatch in criteria expression. Oooops! My access version is 2003, spanish. I would really appreciate ur help, since this matter shouldn't be keeping me busy for so long :( Regards and thx in advance! Alejandro
The following query works fine: SELECT tblProjectSteps.ProjectID, tblProjectSteps.StepID,..., NZ(DSum("Total","tblPayments","ProjectID=" & [ProjectID] & " AND StepID =" & [StepID],0)+ NZ(DSum("Total","tblReceivables","ProjectID=" & [ProjectID] & " AND StepID =" & [StepID],0)+ NZ(DSum("Total","tblBankPayments","ProjectID=" & [ProjectID] & " AND StepID =" & [StepID],0) AS TotalCosts FROM tblProjectSteps INNER JOIN tblSteps ON tblProjectSteps.StepID = tblSteps.StepID;
The 3 summed tables (tblPayments,tblReceivables,tblBankPayments) do all of course have a foreign key for ProjectID (from tblProjects) and StepID (from tblSteps) and the output would be something like
For performance issues I would want to eliminate the DSum part, i.e get me a TotalCosts field by other means . I tried several constructions with multiple queries and also subqueries but to no avail. Any suggestions from the query Cracks her would be greatly appreciated.