Function age

14 posts / 0 new
Last post
BENOIT
Offline
Joined: 11/29/2018 - 11:25

it crash again.
I wrote :
    newFieldName = checkIfFieldNameExists("ECARTDATES", dbname)
    field.Name =  newFieldName
the internal error focuses on the instruction "field.Name =  newFieldName"

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Sometimes you just have to delete a portion of script and just rewriting it, looks like this is what is happening here.  Make sure that field has been properly dimensioned and there is no other variables or functions that could be screwing up that section.

BENOIT
Offline
Joined: 11/29/2018 - 11:25

After several hours of research, I found my mystake !
I souldn't wrote "exercice = Mid(nomfichier,13,8)" because NomFichier is a function !
 
Function NomFichier
    Dim temp_length  As String, a As Integer, i As Integer
    sfilename2 = sfilename
    temp_length  = Len(sFilename2 )
    For i = temp_length To 1 Step -1
        If Mid(sfilename2,i,1) = "\" Then Exit For
    Next
    For a = temp_length To 1 Step -1
        If Mid(sfilename2,a,1) = "." Then Exit For
    Next
    NOMFICHIER = Mid(sfilename2,i+1,a-i-1)
    exercice = Mid(nomfichier,13,8)
End Function

Pages