Where is this code (in what Event does it occur)? What happens when you try
to run it? More questions and comments inline.
alvin Kuiper said:
Hi
Okay, i understand look here:
Dim strText As String
Dim nLines As Long
Dim antallinier As Long
Dim besked As Long
Dim tilbage As Long
antallinier = 2
tegn2 = 150
What is tegn2?
strText = Form_rettekursus.forudsætninger.Text & vbNullString
What is Form_rettekursus.forudsætninger.Text? It seems it may be a field,
but if so, I don't think you want .Text at the end. I don't really
understand the Text property, but aren't you just trying to look at the
contents of the field? If so, how about Me.forudsætninger?
' Trim of trailing CR/LF, if any.
If Right(strText, 2) = vbCrLf Then
Where does the vbCrLf come from? How would it get to the end of
forudsætninger
strText = Left(strText, Len(strText) - 2)
Else
End If
' Split on the CR/LF combination to see
' how many lines we have.
If Len(strText) = 0 Then
nLines = 0
besked = 0
Else
nLines = 1 + UBound(Split(strText, vbCrLf))
tal = (nLines * 50)
What is tal? It is not defined. It it is a number it seems it will always
be at least 100. Is that correct?
tegn = Len(forudsætninger.Text) + tal
Why forudsætninger.Text? Why not strText? Also, what is tegn?
End If
tilbage = antallinier - nLines
tegn3 = (tegn2 - tegn)
tegn has a value only when Len(strText > 0). What is tegn if Len(strText) =
0?
If tegn3 > 100 Then
tegn3 = 100
End If
lblforud.Caption = "Du har " & tilbage & " linier tilbage eller " & tegn3
&
" tegn"
I speak English and a little French. It would help if I knew what some of
these words mean.
If tilbage < 0 Or tegn = 100 Then
Do you mean tegn3 = 100?