'NOTE: To get the Ascii value of the character which is to be replaced. 'In the debug window (Ctrl+G) enter ?asc("}") and replace } with the character you want the value of. 'Then replace XXX in the Case in the code and remove comments :o)
Function fldUpdate(sIn As String) As String Dim sWork As String Dim i As Integer
sWork = sIn
For i = 1 To Len(sWork)
Select Case Asc(Mid(sWork, i, 1))
'Case XXX ' Mid(sWork, i, 1) = "å" 'Case XXX ' Mid(sWork, i, 1) = "Å" Case 125 Mid(sWork, i, 1) = "æ" 'Case XXX ' Mid(sWork, i, 1) = "Æ" 'Case XXX ' Mid(sWork, i, 1) = "ø" 'Case XXX ' Mid(sWork, i, 1) = "Ø" Case Else End Select
What do you want to convert, data in a table? if so then make a new update query using the function as mentioned in my comment 21:26. You can then call the query either from a macro or youcan add a button to a form using the form wizard. You can get thew izard to run your query !
! The code I sent MUST be in a module NOT in a form. When it is in a module all forms and queries have Access to it. If you still getproblems then you can send it to dktebrsa@europe.lego.com and I will take a look!
OK! Your problem is because you have a MISSING reference! In code view go to the Tools+References menu. You will see MISSING beside one of the references, remove the check in the check box. It shouls work now. But nothing is going to get converted! In the test data you sent there are NO characters which have to be converted. Example: } as in g}r whcih you wnat converting to æ
If you send me a list of the charcaters you want converting then I will correct the code. I need to know the characters to convert and to what they are to be converted to!
Function fldUpdate(sIn As String) As String Dim sWork As String Dim i As Integer
sWork = sIn
For i = 1 To Len(sWork)
Select Case Asc(Mid(sWork, i, 1))
Case 125 Mid(sWork, i, 1) = "å" Case 93 Mid(sWork, i, 1) = "Å" Case 123 Mid(sWork, i, 1) = "æ" Case 91 Mid(sWork, i, 1) = "Æ" Case 124 Mid(sWork, i, 1) = "ø" Case 92 Mid(sWork, i, 1) = "Ø" Case Else End Select
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.