If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Multi Select List Box to Text Box (put each item on separate line)
Maybe I'm just overlooking the obvious, but is there a way to format the text
in a text box once I've selected it with the following code. (I am putting the names of employees in a text box to show which employees were selected for a particular record. The names are appearing in a straight line and separated by a comma, I would each name to have its own line in the text box. ) Dim varItem As Variant Dim strList As String With Me.Employee If .MultiSelect = 0 Then Me.Employee = .Value Else For Each varItem In .ItemsSelected strList = strList & .Column(0, varItem) & "," Next varItem If strList "" Then strList = Left$(strList, Len(strList) - 1) End If Me.Employee = strList End If End With Also, is there a way to "unhighlight" the multi select text box for the next record (so nothing is highlighted for the next record). I am using a single form view. Thank you. |
#2
|
|||
|
|||
Multi Select List Box to Text Box (put each item on separate line)
Hi Michelle,
Just add the line as below. Michelle wrote: For Each varItem In .ItemsSelected strList = strList & .Column(0, varItem) & "," .Selected(varItem) = False 'unselect listbox Next varItem -- Please Rate the posting if helps you Message posted via http://www.accessmonster.com |
#3
|
|||
|
|||
Multi Select List Box to Text Box (put each item on separate l
Thanks AccessVandal, that did clear out my selections! Do you know how I
would format the text in the text box once I've selected. (I am putting the names of employees in a text box to show which employees were selected for a particular record. The names are appearing in a straight line and separated by a comma, I would each name to have its own line in the text box). Right now my entries are appearing like this in the textbox: Ex: Adams, Micheal,Adkins, Darla K,Albright, Gayla J I would like them to appear like this: Adams, Micheal Adkins, Darla K Albright, Gayla Thanks for your help. "AccessVandal via AccessMonster.com" wrote: Hi Michelle, Just add the line as below. Michelle wrote: For Each varItem In .ItemsSelected strList = strList & .Column(0, varItem) & "," .Selected(varItem) = False 'unselect listbox Next varItem -- Please Rate the posting if helps you Message posted via http://www.accessmonster.com |
#4
|
|||
|
|||
Multi Select List Box to Text Box (put each item on separate l
For Each varItem In .ItemsSelected
strList = strList & .Column(0, varItem) & vbCrLf .Selected(varItem) = False 'unselect listbox Next varItem -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Michelle" wrote in message ... Thanks AccessVandal, that did clear out my selections! Do you know how I would format the text in the text box once I've selected. (I am putting the names of employees in a text box to show which employees were selected for a particular record. The names are appearing in a straight line and separated by a comma, I would each name to have its own line in the text box). Right now my entries are appearing like this in the textbox: Ex: Adams, Micheal,Adkins, Darla K,Albright, Gayla J I would like them to appear like this: Adams, Micheal Adkins, Darla K Albright, Gayla Thanks for your help. "AccessVandal via AccessMonster.com" wrote: Hi Michelle, Just add the line as below. Michelle wrote: For Each varItem In .ItemsSelected strList = strList & .Column(0, varItem) & "," .Selected(varItem) = False 'unselect listbox Next varItem -- Please Rate the posting if helps you Message posted via http://www.accessmonster.com |
#5
|
|||
|
|||
Multi Select List Box to Text Box (put each item on separate l
Thanks to both Doug and AccessVandal, this worked perfectly!
"Douglas J. Steele" wrote: For Each varItem In .ItemsSelected strList = strList & .Column(0, varItem) & vbCrLf .Selected(varItem) = False 'unselect listbox Next varItem -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Michelle" wrote in message ... Thanks AccessVandal, that did clear out my selections! Do you know how I would format the text in the text box once I've selected. (I am putting the names of employees in a text box to show which employees were selected for a particular record. The names are appearing in a straight line and separated by a comma, I would each name to have its own line in the text box). Right now my entries are appearing like this in the textbox: Ex: Adams, Micheal,Adkins, Darla K,Albright, Gayla J I would like them to appear like this: Adams, Micheal Adkins, Darla K Albright, Gayla Thanks for your help. "AccessVandal via AccessMonster.com" wrote: Hi Michelle, Just add the line as below. Michelle wrote: For Each varItem In .ItemsSelected strList = strList & .Column(0, varItem) & "," .Selected(varItem) = False 'unselect listbox Next varItem -- Please Rate the posting if helps you Message posted via http://www.accessmonster.com |
Thread Tools | |
Display Modes | |
|
|