Multiline textbox in Access 2000

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

How do you set line breaks in an Access textbox? In VB6,
I set the MultiLine property to True and use

myTextBox.Text = "Line 1" & vbNewLine & "Line 2"

which works fine. In Access 2000, it's all on one line.
Also, there is no MultiLine property.

Thanks in advance,
Gary
 
ACCESS uses the combination of carriage return and line feed (in that
order).

myTextBox.Text = "Line 1" & vbCfLf & "Line 2"
 
Thanks, something else must be going on in my case
because I started a brand new form with a textbox and
either one works (vbCrLf or vbNewLine).
Gary
 
Where are you using this expression? If in the control source of a textbox,
then oops, my error...I forgot again that the VB constants don't work in
control sources.

Use this instead if it's in a control source:

= "Line 1" & Chr(13) & Chr(10) & "Line 2"

If however, you're using VBA code to write into the textbox, then, unless
the textbox has the focus, you must use the .Value property of the textbox,
not the .Text property. VB uses Text, but in ACCESS the Text is what is
displayed in the control and it's only accessible when the control has the
focus. We use .Value instead.
 
Back
Top