Avatar billede mysupport Nybegynder
20. april 2005 - 11:24 Der er 13 kommentarer og
1 løsning

Ang. Opdeling af vej og husnummer

Se:
http://www.eksperten.dk/spm/611296

Det er indsat i forespørgslen, og det virker... Indtil den giver en runtime error nr. 5 på:

    SplitADR1_FindGadenavn = Left(ADR1, pos - 2)

Den regner de første mange ud, men så stopper den på denne fejl. Hvad er der galt her?
Avatar billede terry Ekspert
20. april 2005 - 11:33 #1
The problem is very likely becuase one of the addresses doesnt suit the algorithm used to split it up.

Cant you try debbuging the code?
Avatar billede mysupport Nybegynder
20. april 2005 - 11:34 #2
I don't really know how to debug code :(
Avatar billede terry Ekspert
20. april 2005 - 11:34 #3
what values does ADR1 and pos have when you get the error?
Avatar billede terry Ekspert
20. april 2005 - 11:35 #4
Can you send me your db?
eksperten@NOSPAMsanthell.dk
remove NOSPAM
Avatar billede mysupport Nybegynder
20. april 2005 - 11:43 #5
Is it ok if i just send you the address field, it is client data, and as such, confidential
Avatar billede terry Ekspert
20. april 2005 - 11:45 #6
Yes, no problem, I just want to see the data and debug through Thomas's code to see what is happening
Avatar billede mysupport Nybegynder
20. april 2005 - 11:53 #7
The problem is that there are many occurences where there is no address at all entered, only an e-mail. and a couple with a number first in the sequence (foreign addresses.
Avatar billede terry Ekspert
20. april 2005 - 11:57 #8
this is obvioulsy the problem, so Thomas's code will need altering.

Problem is what do you want to see if the address can not be split up?
Avatar billede terry Ekspert
20. april 2005 - 12:01 #9
You might be able to use this

Public Function SplitAdresse_FindGadenavn(Adresse As String) As String
    Dim pos As Integer

on Error goto Proc_Err

    pos = 1
    Do Until pos >= Len(Adresse) Or (Mid(Adresse, pos, 1) >= 0 And Mid(Adresse, pos, 1) <= 9)
        pos = pos + 1
    Loop
    SplitAdresse_FindGadenavn = Left(Adresse, pos - 2)

exit function

Proc_Err:
SplitAdresse_FindGadenavn = ""
End Function

Public Function SplitAdresse_FindVejnr(Adresse As String) As String
on Error goto Proc_Err

    SplitAdresse_FindVejnr = Mid(Adresse, Len(SplitAdresse_FindGadenavn(Adresse)) + 2)

exit function

Proc_Err:
SplitAdresse_FindVejnr = ""

End Function
Avatar billede terry Ekspert
20. april 2005 - 12:01 #10
if an error occurs then you get an empty string (not tested)
Avatar billede mysupport Nybegynder
20. april 2005 - 12:10 #11
Hi Terry
The query no longer returns an error, but it still writes #Fejl  this is not critical, but it would be nicer to have the fields blank, since there really is no address
Avatar billede terry Ekspert
20. april 2005 - 12:14 #12
I think I need to see the dB if that is OK?
Avatar billede mysupport Nybegynder
20. april 2005 - 12:20 #13
Sorry, can't send it. Out of 33000 clients it is only a problem on 30, so I think I'll need to hand correct it. But you'll get the points :)
Avatar billede terry Ekspert
20. april 2005 - 12:37 #14
thanks :o)
Avatar billede Ny bruger Nybegynder

Din løsning...

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.

Loading billede Opret Preview
Kategori
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester