31. januar 2002 - 12:49
Der er
8 kommentarer og 1 løsning
Ændring af format i Access 2000
Jeg har en masse adresseregistreringer der er konverteret fra et andet databasesystem til Access. Posten "navn" står nu i access som eks. JENSEN/KARL HANSEN/ALICE Hvordan får jeg byttet om på for- og efternavn og erstattet / med et mellemrum eks. KARL JENSEN ALICE HANSEN Evt. skrive en kode i format feltet ?
Annonceindlæg tema
Cloud & AI
I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
31. januar 2002 - 13:00
#1
make a module and place the folloowing code in it. Function cNavn(sin As String) As String Dim sWork As String Dim i As Integer sWork = sin i = InStr(1, sin, "/") sWork = Mid(sin, i + 1, Len(sin) - i) & " " sWork = sWork & Left(sin, i - 1) Debug.Print sWork cNavn = sWork End Function Then you make an update query setting the update To field to CNavn([navn])
31. januar 2002 - 21:24
#2
Hows it going? you can delete the line Debug.print sWork
01. februar 2002 - 11:43
#3
Hi Terry, Thank you for your help ! :-) - it works ! But there is an error runtime error '5' - when I debug this statement is outlined: sWork = sWork & Left(sin, i - 1) I have about 14.000 names but only the first 1.400 names are changed. - I have tried to deled name 1.401 an activate the query again with no change. Hope this makes sense
01. februar 2002 - 12:24
#4
add this to the start of the function after the Dim i As Integer line If isNull(sin) then exit function and see if that helps
01. februar 2002 - 13:52
#5
It?s the same ? is it possible to skip the names that causes the error ?
01. februar 2002 - 14:22
#6
I am trying to skip those which cause the error, but it isnt always easy to know what the field contains. Try this: Function cNavn(sin As String) As String Dim sWork As String Dim i As Integer sWork = sin i = InStr(1, sin, "/") if i = = Then Cnavn = "" Exit Function end if sWork = Mid(sin, i + 1, Len(sin) - i) & " " sWork = sWork & Left(sin, i - 1) cNavn = sWork End Function
01. februar 2002 - 15:12
#7
It cant compile this statement: if i = = Then Again thank you for your effort ! :-)
01. februar 2002 - 21:37
#8
if I = 0 Then
02. februar 2002 - 13:32
#9
Yes ! This time it went through all the names – there were 255 names with wrong format - these were skipped. Thanks again :-)
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser