Hello
I'm running an access query to output customer values for invoicing to a file. As part of the process we have to produce Modulus 11 checkdigits aswell. I'm using an access module for this. I'm getting the following error's
Run-time error'94'
Invalid use of null
here's the code with the line repeated at the end which appears to causing the problem.
ublic Function anpostocr(CheckDigit)
'--checkdigit$ = Command$
Dim checkarray(40)
Dim weight(40)
'If Format([CheckDigit]) = "0000.00" Then
'CheckDigit = (CheckDigit * 100)
CheckDigitST = Str(CheckDigit)
lent = Len(CheckDigitST) '--get lenght of string
For I = 0 To (lent - 1) '--split up string digit by digit & put in array
checkarray(I + 2) = Val(Mid$(CheckDigitST, (lent - I), 1))
Next I
For I = 2 To lent + 1 '--calculate the weights for each digit
weight(I) = (checkarray(I) * I)
sum = sum + weight(I)
Next I
'--sum now holds value we need
CheckDigit = 11 - (sum Mod 11)
If CheckDigit >= 10 Then CheckDigit = CheckDigit - 10 '---for case of 10 or 11
checkarray(1) = CheckDigit '--add the checkdigit to the
'-- for debug only-- Print " CheckDigit is > "; CheckDigit
For I = (lent + 1) To 1 Step -1 '--go through the array backwards & rebuild string with check digit attached
checkout$ = checkout$ + LTrim$(Str$(checkarray(I)))
Next I
CheckDigit = checkout$
anpostocr = checkout$
'--Print checkout$
End Function
For I = 0 To (lent - 1) '--split up string digit by
I'm also getting the following error
"This expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables
."
The strange thing about this problem is that it dosen't happen al the time.
Any help would appreciated on this matter.
Paraic.