MAke a newline in a memofield

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I have a counter in a memofield
there count characters
is there a way where i can say
if characters = 30 then make a newline??

regards
alvin
 
Hey Alvin,

Hope I'm following you correctly and that I get this right. Try this in the
MemoControls OnGotFocus or Enter event properties.

If Me.NameOfCounter => "30" Then
Me.NameOfMemo = Me.NameOfMemo & vbCrLf
End If

HTH,
Shane
 
Thanks
But i just see noe i can't use this
because my counter count the
counter counts all the characters in my memofiel what
i sould use was a counter there can count the characters in a line
and the say if count off characters >=30 then make a new line
and again counters of characters = 0

but thanks for the help

Alvin
 
Thanks
But i just see noe i can't use this
because my counter count the
counter counts all the characters in my memofiel what
i sould use was a counter there can count the characters in a line
and the say if count off characters >=30 then make a new line
and again counters of characters = 0

I'm not sure you really would
want to do that. Wouldn't it l
ead to lines being broken up l
ike this, in the middle of wor
ds?

You can set the Enter Key behavior property of the textbox to "New
Line in Field" so that hitting the Enter key will give you a new line;
or you can use the Change event of the combo box with code like

Private Sub txtMemofield_Change()
If Len([memofield] MOD 30 = 0 Then
Me!memofield = Me!memofield & vbCrLf
End If

to insert a carriage return every 30th character (including 2 for each
previous line end, you might want to use 32).

John W. Vinson[MVP]
 
Back
Top