Replace code

  • Thread starter Thread starter tazman2586
  • Start date Start date
T

tazman2586

Guest
Hello,
I have a access database and now i want in a table named [Naam] replace all ä with à, how do i program that.

Special thanks
Ed
 
Try using the replace function ;)
 
replace

How do i do that, i'm a newby at this point.

Thanks
 
Pick up the book and find it in the Reference list
or Hit F1 and search the Access help for it...
 
Open up your Table in datasheet view

Then click on edit ---> Replace

Then use that to replace the letters
 
I was thinking of doing it with a query, but that'll work too.

thanks for nothing
i can easily copy the help for you. I can tell you its more informative than the way I would be able to explain of how to use it.
The Help is your friend, not your foo...
 
Het is me gelukt, voor degene die er interesse in hebben is hier de code.

Dim Naam As String
Dim db As Database
Dim rs As Recordset

Set db = CurrentDb
Set rs = db.OpenRecordset("Tabelnaam")

While Not rs.EOF
rs.Edit
rs("[NAAM]").Value = Replace(rs("[NAAM]"), "÷", "ö")
rs("[NAAM]").Value = Replace(rs("[NAAM]"), "Ú", "é")
rs("[NAAM]").Value = Replace(rs("[NAAM]"), "Ù", "ë")
rs("[NAAM]").Value = Replace(rs("[NAAM]"), "³", "ü")
rs("[NAAM]").Value = Replace(rs("[NAAM]"), "±", "ñ")
rs("[NAAM]").Value = Replace(rs("[NAAM]"), "Ý", "í")
rs("[NAAM]").Value = Replace(rs("[NAAM]"), "¶", "ô")
rs("[NAAM]").Value = Replace(rs("[NAAM]"), "Õ", "ä")
rs("[NAAM]").Value = Replace(rs("[NAAM]"), "¾", "ó")
rs("[NAAM]").Value = Replace(rs("[NAAM]"), "¹", "û")
rs("[NAAM]").Value = Replace(rs("[NAAM]"), "ß", "á")
rs("[NAAM]").Value = Replace(rs("[NAAM]"), "þ", "ç")

rs.Update
rs.MoveNext
Wend
MsgBox "Leestekens veranderen is voltooid", vbOKOnly, "Leestekens veranderen"

rs.Close
db.Close
 
Last edited:
Tho you probably will not accept it, I will try to add this for you....

You know you can "nest" the replace?

rs("[NAAM]").Value = Replace(Replace(rs("[NAAM]"), "Ú", "é"),"÷", "ö")

Doesnt make much of a difference but still... And the nexted Replace you can use in a query too, tho you may agree with me that it doesnt add to readability and is not quite good for maintenance....

About your rs... You know you can also use rs!Naam instead of rs("Naam").value ?? Also .value is the default, so you dont need to use that at all...

Lastly about your declarations... I think your using DAO, it is best to "disambiguate" to prevent any mixups...
Dim db As DAO.Database
Dim rs As DAO.Recordset

Oh, I allmost forget: Well done... :)
 

Users who are viewing this thread

Back
Top Bottom