Modules & VBA :: Edit Replace Via Script Several Changes?

Sep 21, 2014

Within my table 'Contacts' I have the field 'City' which as you would expect contains the city.

The data in the City field which is sourced from the web can often merge two regional municipalities into 1 and I know through digging in behind the data what the correct answer should be.

I am looking to accomplish a list of edit replaces that takes 30 + edits and automates.

Change "ClevelandAkron" to "Cleveland"
Change "Dublin 2" to "Dublin"
Change "Greensboro/Winston-Salem" to "Greensboro"
etc. etc.

There are 10,000 plus entries in the table of which many are correct.

View Replies


ADVERTISEMENT

Edit Replace Tables In Query??

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

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

Modules & VBA :: Replace Null Value

Nov 10, 2014

Is there a code that will replace the empty fields by shifting the bottom fields up for access? I am planning to write a code that will delete unnecessary items in my database, however, that will cause the database to have "holes" in it.

View 4 Replies View Related

Modules & VBA :: How To Replace Characters With Spaces

Jun 26, 2014

I'm working on an eBay uploader access program for Ebay's File Manager

Our description contains line feeds and carriage returns. I have very little knowledge of Vba, and I can t find any tutorials on how to replace the characters with spaces on how to program this.

The table is called tblCustomer
The field is called *Description

I'm using access 2007

View 9 Replies View Related

Modules & VBA :: Replace Blank Fields With 0

Mar 24, 2014

I try to go throgh all columns and replace all blank fields with 0.Somehow this doesn't work:

Code:
Sub TEST()
Dim str As String
Dim rs As DAO.Recordset
Dim fld As DAO.Field

[code]...

View 7 Replies View Related

Modules & VBA :: How To Replace Some Values From Another Query

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

Modules & VBA :: Replace Values By DSUM

Dec 16, 2013

I want to replace some values in a TNS_QUERY with DSUM. The error message tells me I have to use an updateable table.

How can I avoid to create a query and replace the values directly in the original table TNS? I just group on the original table.

Code:
Public Sub TNS_QUERY()
Dim strSQL As String
Dim x As Double
Dim qdf As QueryDef
strSQL = "SELECT TNS.[Division],TNS.[Customer_Split],SUM([TOTAL_NET_SALES])

[Code] ....

View 2 Replies View Related

Modules & VBA :: Replace Front End DB With Another Database

Sep 23, 2014

I have a split database. When the front end db is updated, i am attempting to delete the end users copy and replace with the updated version.

I have gotten as far as being able to open Database A, Open Database B with A and Close Database A, but it will not let me delete Database A from B because the procedure originated from Database A.

View 11 Replies View Related

Modules & VBA :: Replace Batch Number From All Tables

Jan 23, 2015

I have 4 tables with a field that holds a "batch number" there can be many batch numbers in these fields.I want if possible to replace a batch number from all my tables that contains that data and replace it with another batch number in one go. is a macro the only way to do this.I would like a macro that asks me the batch number to replace and then asks me the number to replace it.

View 14 Replies View Related

Modules & VBA :: How To Cancel Carriage Return And Replace With Tab

Jul 30, 2015

How i can cancel the a carriage return and replace with a tab or stop it moving down my subform and make it move the the next field instead of going to a new line.

I am using the Keydown but don't know how to cancel it, it just bring an message but it stops it moving to a new record,

Code:

Private Sub Barcode_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
MsgBox "rtn pressed"
End If
End Sub
End If

View 5 Replies View Related

Modules & VBA :: Find And Replace Special Characters

Dec 18, 2013

I have a table called: "tb_special_characters" with a field name [character]. In this table are values that I would like to remove from fields in another table ("tb_data", field name [Title]

The values in the "tb_special_characters" are thinks like
.
@
}

I'd like to run a query on tb_data.title that would replace any matching characters in tb_special_characters.character with nothing (I remove and close any spaces).

View 2 Replies View Related

Modules & VBA :: Replace Embedded Logo Images?

Feb 13, 2014

I need to replace the embedded image on a large number of reports and forms. I'm looking for a way to loop through all of the controls in my forms and reports and if the control is an image, replace the embedded image with a new one. Can this be done using vba?

View 5 Replies View Related

Modules & VBA :: Replace Function Using Form Control Value

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

Modules & VBA :: Code To Replace Special Character With Space

Jun 12, 2015

We have a spreadsheet that i upload onto a table, i use on of the fields to build a file path but if there is a special character it causes problems,i need to replace the below with spaces if they are in my field called path

< (less than)
> (greater than)
: (colon)
" (double quote)
/ (forward slash)
(backslash)
| (vertical bar or pipe)
? (question mark)
* (asterisk)
. (full stop)
, (commer)

how i can do this in some sort of update query.

View 1 Replies View Related

Modules & VBA :: Replace Hard Code Directory Path With Textbox

Jun 17, 2013

How do I direct the ZipFilePath and ZipFolderPath to use a directory I define in a textbox in a form? Instead of hard code like it is now?

Option Compare Database
Option Explicit
Public Sub NewZip(ZipFilePath)
On Error GoTo Err_NewZip
Dim lngFile As Long
lngFile = FreeFile

[Code] ......

View 2 Replies View Related

Modules & VBA :: Replace Line Of Code During Split Form Front End Deployment?

Aug 11, 2015

I have a database that I've split and have deployed to 7 persons.

The thing is, I have three (3) forms:

Form 1
Form 2
Form 3

...that require changing a portion of a line in each form's respective VBA codes. I need to change the directories to where an excel workbook is stored after exporting, and another is where same excel is moved to after being uploaded.

At the moment, during deployment I have to manually change the directories.

I was thinking of maybe a pop-up form with four (4) fields that allows the user to select his/her name at the start-up of their frontend app, and paste the directories in the other text boxes provided.

This information will then be used to replace the directories in the VBA.

If I were to make changes and have to redeploy, I would have to do everything manually again.

View 6 Replies View Related

Modules & VBA :: Replace Function In Access 2007 For HTML Email In Outlook 2010

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

Modules & VBA :: Using ADO To Edit Result Of A Query

Sep 30, 2013

For some reason i've had to make an update on some old VBA projects of mine. In this update i switch all references of DAO to ADO. I know there are some limits to what i can accomplish with ADO (where i would need to use DAO). Anyways in some of these old projects i use an SQL statement to provide me with a limited number of records which i then modify by iterating through the recordset.

I can't get this to work with ADO. It's as if it always expects me to provide a table in the argument.

In short my question is. Is it possible to change the values returned from an SQL statement using ADO

Code:
'This is the DAO version which is exactly what i'm looking to using ADO
strSqlCommandText = "SELECT tblMain.TaskID, tblMain.Heading FROM tblMain WHERE (((tblMain.TaskID)=" & ProcessForm.txtIDValue.Text & "))"
Set objRecordset = pubObjDatabase.OpenRecordset(strSqlCommandText, dbOpenDynaset)
objRecordset.Edit
objRcsToDbTable.Fields("Heading") = ProcessForm.txtBoxHeading.Text
objRecordset.Update

This is what i've done and it doesn't work.

Code:
strSqlCommandText = "SELECT tblMain.TaskID, tblMain.Heading FROM tblMain WHERE (((tblMain.TaskID)=" & ProcessForm.txtIDValue.Text & "))"
Set objRecordset = New ADODB.Recordset
objRecordset.Open strSqlCommandText, pubObjDatabase, adOpenDynamic, adLockOptimistic
objRecordset.Edit
objRcsToDbTable.Fields("Heading") = ProcessForm.txtBoxHeading.Text
objRecordset.Update

I can think of some work around like, creating a temp table and insert/update all the records from there or creating an UPDATE SQL statement.

View 6 Replies View Related

Modules & VBA :: Edit Dataset Works And Add A New One

Aug 4, 2013

I have an edit button in my form which activates VBA, collects all data from the fields and edit the dataset. Everything work fine except the case that next to the edit access adds a new record as well with exactly the same data.

This is my code :

Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("select * from tbllocations where locationid = " & cdkey)

[code]...

I checked every parameter and it seems everything is OK which surely is the base for the correct edit of the dataset. locationid is the key of the table.

View 3 Replies View Related

Modules & VBA :: Edit Specific Row In Table

Dec 30, 2013

I have a report that I run which has PT_Ins_ID in it, I am trying to edit that row with the following code.

Code:
Private Sub cmd_Deact_Click()
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("dbo_Patient_Insurance")
If rs.RecordCount <> 0 Then
With rs

[code]....

I've also tried this.

Code:
Dim rs_PI As DAO.Recordset
Set rs_PI = CurrentDb.OpenRecordset("dbo_Patient_Insurance")

[code]...

View 6 Replies View Related

Modules & VBA :: How To Edit A Publisher Text Box

Jun 25, 2014

I'm currently using the following to edit a publisher document using access VBA.

Code:
For Each pubShape In pubDoc.Pages(1).Shapes
If pubShape.HasTextFrame Then
If pubShape.Name = "Text Box 440" Then pubShape.TextFrame.TextRange.Text = Item1
If pubShape.Name = "Text Box 441" Then pubShape.TextFrame.TextRange.Text = Item2
If pubShape.Name = "Text Box 442" Then pubShape.TextFrame.TextRange.Text = Item3
If pubShape.Name = "Text Box 443" Then pubShape.TextFrame.TextRange.Text = Item4
If pubShape.Name = "Text Box 444" Then pubShape.TextFrame.TextRange.Text = Item5
If pubShape.Name = "Text Box 445" Then pubShape.TextFrame.TextRange.Text = Item6
If pubShape.Name = "Text Box 446" Then pubShape.TextFrame.TextRange.Text = Item7
If pubShape.Name = "Text Box 447" Then pubShape.TextFrame.TextRange.Text = Item8
End If
Next

Obviously there are a lot of shapes/boxes etc in the document and this code is very inefficient and takes a few moments to complete. Is there a way to directly reference a text box and change its value. For word I have been using bookmarks but this doesn't seem to work with publisher.

I'm looking for something like pubshape.Value("text Box 440") = Item1 but cannot find the correct syntax.

View 2 Replies View Related

Modules & VBA :: Edit Conditional Statements Via Form

Aug 31, 2013

I have a table of marks of student, a query that calculates totals and a form that displays results. on the query, i have an if statement.

Code:
comment:IIf([Marks]>=80,"good",IIf([Marks]>=50,"fair",IIf([Marks]>=40,"Work harder")))

So i want to be able to make the whole syntax available for user to edit without actually doing it in vba. is this possible in vba? i have attached an image

View 8 Replies View Related

Modules & VBA :: Edit Multiple Records From List Box?

May 25, 2014

I have two table. Table 1 (assets) list all my assets etc. Table 2 lists all servicing for each asset.

I have a form which generates a list box of items that require servicing (once servicing has been completed on these items) I would like to update all records, in both tables. Table 2 with all the information about the service. and Table 1 with (only) the next service date.

I have set the list box to allow multiple selection and have used the following code to allow new records to be update in table 2 (which works). but I cant seem to get the code to edit one cell in table 1.

private Sub Command59_Click()
Dim strSQL As String
Dim db As DAO.Database

[Code].....

View 4 Replies View Related

Modules & VBA :: Edit Junction Table - Unbound

Jun 11, 2015

New to access (and this forum) and working on a small db that includes the following tables:

tbl_Orders
tbl_Junction (Order Details)
tbl_Products

While the form itself is bound to tbl_Orders I decided to use unbound text boxes to enter the data (knowing I was in for some work!). Reason is that if textboxes were bound would need to use a subform with multiple combo boxes and that UI did not seem suitable for the application.

I’ve completed the code to add new records to tbl_Orders and tbl_Junction from the unbound textboxes. I'm using the VBA .AddNew method and is working well. Now I need to integrate code that will allow users to edit existing records while they are viewing them on the form.

I have the code to look up the record set I want to edit in tbl_Junction and am familiar with the .Edit method but the issue is that the required changes MAY include not just editing existing records but also deleting and adding new records. For example, the initial order may have been for Apples and Oranges and the revised order may change the number of Apples, eliminate Oranges entirely, and add some Bananas. So, it seems I need to .Edit Apples, .Delete Oranges, and .AddNew Bananas?

Should I try to write code to determine where I need to .Edit/.AddNew/.Delete? -- not looking forward to that. Thought maybe could delete the entire junction record set and then just .AddNew for everything per the revised order. That should work as the display on the form would be correct for the whole order. But maybe would cause a problem as would remove the FK in tbl_Junction that corresponds to the PK in tbl_Orders?

View 14 Replies View Related

Modules & VBA :: Edit JPG To Make Rounded Corners

Apr 21, 2014

Is there some possibility to edit jpg file and do rounded corners via access vba?

I can use command line of Irfanview for copy, resize, etc.of jpeg but I dont know how to do rounded corners ...

View 4 Replies View Related







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