Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Microsoft Access > Re: VBA/Access ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 30406 of 31576
Post > Topic >>

Re: VBA/Access Global Search&Replace from LUT

by "simon.robin.jackson@[EMAIL PROTECTED] " <simon.robin.jackson@[EMAIL PROTECTED] > May 30, 2008 at 02:29 AM

This requires a table called tblReplace with two text fields, old and
new.

Code:
On Error Resume Next

Dim db As DAO.Database
Dim td As DAO.TableDef
Dim f As DAO.Field
Set db = CurrentDb
For Each td In db.TableDefs
    If td.Name <> "tblReplace" And Left(td.Name, 4) <> "msys" Then
        For Each f In td.Fields
            SQL = "UPDATE [" & td.Name & "] INNER JOIN tblReplace ON
[" & _
                td.Name & "].[" & f.Name & "] = tblReplace.old SET ["
& _
                td.Name & "].[" & f.Name & "] = [tblReplace]![new];"
            db.Execute SQL
            Select Case Err.Number
            Case 0
            Case 3615: Err.Clear
            Case Else
                MsgBox Err.Number & vbCrLf & Err.Description
                Exit Sub
            End Select
        Next
    End If
Next


Anyone disagree?
 




 4 Posts in Topic:
Re: VBA/Access Global Search&Replace from LUT
"simon.robin.jackson  2008-05-30 02:29:39 
Re: VBA/Access Global Search&Replace from LUT
"paii, Ron" <  2008-05-30 10:14:52 
Re: VBA/Access Global Search&Replace from LUT
"Larry Linson"   2008-05-30 17:30:53 
Re: VBA/Access Global Search&Replace from LUT
"paii, Ron" <  2008-05-30 13:10:10 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 23:06:17 CST 2008.