Avatar billede oomalkeoo Nybegynder
09. november 2003 - 16:31 Der er 17 kommentarer og
1 løsning

tjek felt

hvordan kan jeg lave en slags "makro" der tjekker feltet email og finder ud af om alle er med @ og med . og uden mellenrum?
Avatar billede mugs Novice
09. november 2003 - 17:47 #1
Avatar billede jkrons Professor
10. november 2003 - 12:48 #2
mugs-> I dt link blev alle forslag afvist :-)
Avatar billede terry Ekspert
10. november 2003 - 20:36 #3
Well I havent checked this, I'll leave that up to you

' Function IsEmailValid(strEmail)
' Action: checks if an email is correct.
' Parameter: strEmail - the Email address
' Returned value: on success it returns True, else False.
Function IsEmailValid(strEmail)
 
    Dim strArray
    Dim strItem
    Dim i
    Dim c
    Dim blnIsItValid
 
    ' assume the email address is correct 
    blnIsItValid = True
   
    ' split the email address in two parts: name@domain.ext
    strArray = Split(strEmail, "@")
 
    ' if there are more or less than two parts 
    If UBound(strArray) <> 1 Then
        blnIsItValid = False
        IsEmailValid = blnIsItValid
        Exit Function
    End If
 
    ' check each part
    For Each strItem In strArray
        ' no part can be void
        If Len(strItem) <= 0 Then
            blnIsItValid = False
            IsEmailValid = blnIsItValid
            Exit Function
        End If
       
        ' check each character of the part
        ' only following "abcdefghijklmnopqrstuvwxyz_-."
        ' characters and the ten digits are allowed
        For i = 1 To Len(strItem)
              c = LCase(Mid(strItem, i, 1))
              ' if there is an illegal character in the part
              If InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 And Not IsNumeric(c) Then
                  blnIsItValid = False
                  IsEmailValid = blnIsItValid
                  Exit Function
              End If
        Next
 
      ' the first and the last character in the part cannot be . (dot)
        If Left(strItem, 1) = "." Or Right(strItem, 1) = "." Then
          blnIsItValid = False
          IsEmailValid = blnIsItValid
          Exit Function
        End If
    Next
 
    ' the second part (domain.ext) must contain a . (dot)
    If InStr(strArray(1), ".") <= 0 Then
        blnIsItValid = False
        IsEmailValid = blnIsItValid
        Exit Function
    End If
 
    ' check the length oh the extension 
    i = Len(strArray(1)) - InStrRev(strArray(1), ".")
    ' the length of the extension can be only 2, 3, or 4
    ' to cover the new "info" extension
    If i <> 2 And i <> 3 And i <> 4 Then
        blnIsItValid = False
        IsEmailValid = blnIsItValid
        Exit Function
    End If

    ' after . (dot) cannot follow a . (dot)
    If InStr(strEmail, "..") > 0 Then
        blnIsItValid = False
        IsEmailValid = blnIsItValid
        Exit Function
    End If
 
    ' finally it's OK 
    IsEmailValid = blnIsItValid
   
End Function
Avatar billede terry Ekspert
10. november 2003 - 20:46 #4
and there are other solutions out there too :o)

http://www.developerfusion.com/show/3350/
Avatar billede terry Ekspert
11. november 2003 - 19:05 #5
og?
Avatar billede terry Ekspert
13. november 2003 - 18:49 #6
how about responding to this question!
Avatar billede terry Ekspert
17. november 2003 - 18:58 #7
come on, if you dont pull your finger out then admin is comming after you !
Avatar billede terry Ekspert
19. november 2003 - 20:58 #8
time is almost up here!
Avatar billede terry Ekspert
02. december 2003 - 19:59 #9
anmeldt!
Avatar billede nikolajdu Nybegynder
02. december 2003 - 20:32 #10
Email sent to oomalkeoo.

/Nikolaj /co-admin
Avatar billede terry Ekspert
02. december 2003 - 21:00 #11
Tak :o)
Avatar billede oomalkeoo Nybegynder
04. december 2003 - 16:04 #12
kunne ikke få det til at virke, så
Avatar billede oomalkeoo Nybegynder
04. december 2003 - 16:05 #13
fik det aldrig til at virke, så droppede det, brugte et par timer på det
Avatar billede nikolajdu Nybegynder
04. december 2003 - 18:19 #14
You could have asked Terry about your problems instead - I'm sure he would gladly help.
Avatar billede terry Ekspert
04. december 2003 - 19:52 #15
oomalkeoo>I dont accept that you have rejected this answer as I happen to know that it DOES work!

http://www.eksperten.dk/spm/268635
Avatar billede terry Ekspert
05. december 2003 - 13:59 #16
nikolajdu>whats your opinion here?

Also, if oomalkeoo cantget it working then it must mean he still needs help, so why has he closed and taken the points himself? Looks strange to me!
Avatar billede nikolajdu Nybegynder
05. december 2003 - 17:39 #17
terry - This is one of the dillemas one can get from eksperten.dk. On one side one cannot expect that everyone can understand the nature of a answer even if it surely works.

On the other side there nothing in the rules that forces the users to give away his/hers points. As the rules are now we can only stop this kind of abuse if it is continously - There it go under the rule that say "one may not abuse the pointsystem of eksperten".

In other words, if the user often closes questions to his own favour - Then I can act - I cannot now even though I personally sees this as a hopeless example in how not to use eksperten".

A little adwise for the future will be : make a good question and PARTICIPATE - If you do not nobody can help you.
Avatar billede terry Ekspert
06. december 2003 - 10:23 #18
Yes I understand the problems with the system and that some users WILL take advantage of these flaws.

But one thing for sure, oomalkeoo isnt going to get help from me again, and I will do as much as possible to influence others in this category to do the same :o)

Thanks for your assistance nikolajdu!
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