| re: Hard return in unbound textbox printing in report
You might try
Private Sub ReportList_Click()[color=blue]
>
> Dim varItem As Integer
> Dim strList As String
>
> With Me!ReportList
> If .MultiSelect = 0 Then
> Me!txtSelected = .Value
>
> Else
> For Each varItem In .ItemsSelected -1
> strList = strList & .Column(0, varItem) & vbCRLF
> Next varItem[/color]
strList = strList & .Column(0, varItem) ' I think this should pick up
the last row without the additional New Line[color=blue]
>[color=green]
> > Me.Text3 = strList[/color]
>
> End If
> End With
> End Sub[/color]
Phil
"ManuelC" <botuco@hotmail.com> wrote in message
news:1123527244.190640.220740@f14g2000cwb.googlegr oups.com...[color=blue]
> Hi
>
> I have a form that contains a multiselect listbox (simple multiselect)
> and a command button. The listbox shows a list of all reports (about
> 20) available for users to print and the command button has an
> onclick() event for printing these reports.
>
> I also have a textbox in the form that shows which reports have been
> selected.
>
> I have these lines of code attached to the OnClick() event on the
> listbox (initially graciously provided by Arvin Meyer MVP but with
> slight modifications)
>
> Private Sub ReportList_Click()
>
> Dim varItem As Variant
> Dim strList As String
>
> With Me!ReportList
> If .MultiSelect = 0 Then
> Me!txtSelected = .Value
>
> Else
> For Each varItem In .ItemsSelected
> strList = strList & .Column(0, varItem) & vbNewLine
> Next varItem
>
> If strList <> "" Then
> strList = Left$(strList, Len(strList) - 1)
>
> End If
> Me.Text3 = strList
>
> End If
> End With
> End Sub
>
> Code works fine but when i go to print a report with the results of the
> textbox, i get a small box - unprintable character (hard return??)at
> the end of the last selection. I found how to get rid of it with an
> update query in a table in other postings but since my textbox is
> unbound, i can't seem to find a way to get rid of this character.
>
> Thanks for your help
>[/color] |