Listbox problem

P

Paul

Hi,

I'm using access 2003;

I've got a form with several listboxes;

One of these listboxes has a list of names in it. When I double click on
this listbox the selected value is added to a text field (marked as memo).
This field is bound to a table and can contain several values (names). What I
would like to achieve is that every value that is put into the text field is
shown on a new line in that field.

With the code I'm using now :) me.textbox.value=me.textbox.value &
me.listbox.value) every value is put directly after the other;

Value1Value2Value3 and I would like it to be like this;

Value1
Value2
Value3

If tried with Sendkeys and Chr() in the code but it didn't produce the
desired effect.

Anybody any ideas?

Cheers,

Paul
 
J

John Spencer

Try the following to add a new line between the items

me.textbox.value=me.textbox.value & vbCRLF & me.listbox.value

OR you can use
me.textbox.value=me.textbox.value & Chr(13) & Chr(10) & me.listbox.value

A new line requires both a carriage return and a linefeed character to
be inserted. And the characters must be in that specific order.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
D

Dirk Goldgar

Paul said:
Hi,

I'm using access 2003;

I've got a form with several listboxes;

One of these listboxes has a list of names in it. When I double click on
this listbox the selected value is added to a text field (marked as memo).
This field is bound to a table and can contain several values (names).
What I
would like to achieve is that every value that is put into the text field
is
shown on a new line in that field.

With the code I'm using now :) me.textbox.value=me.textbox.value &
me.listbox.value) every value is put directly after the other;

Value1Value2Value3 and I would like it to be like this;

Value1
Value2
Value3

If tried with Sendkeys and Chr() in the code but it didn't produce the
desired effect.

Anybody any ideas?


Use a line of code like this:

Me.MyTextbox = Me.MyTextbox & vbCrLf & Me.MyListbox
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top