Connecting Tech Pros Worldwide Help | Site Map

Hard return in unbound textbox printing in report

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 13th, 2005, 12:41 PM
ManuelC
Guest
 
Posts: n/a
Default Hard return in unbound textbox printing in report

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


  #2  
Old November 13th, 2005, 12:42 PM
Phil Stanton
Guest
 
Posts: n/a
Default 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]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.