populating unbound txtBox by code then clicking

  • Thread starter Thread starter tim johnson
  • Start date Start date
T

tim johnson

I have a listbox named lstDisplay on a form. When I
click the list box the following procedure is executed
that populates an unbound textbox named txtDisplay on the
same form.


Private Sub lstDisplay_Click()

strSQL = "SELECT CommentDate, Comments FROM
tblCustomerComments " & _
"WHERE CustomerCommentsID = " & lstDisplay
Set rst = New ADODB.Recordset
Set cnn = CurrentProject.Connection

rst.Open strSQL, cnn, adOpenKeyset, , adCmdText
txtDisplay = rst!CommentDate & ": " & rst!Comments
rst.Close
Set rst = Nothing


End Sub




You notice I am concatanating 2 fields from
tblCustomerComments, CommentDate and Comments then
displaying them in the unbound control, txtDisplay.

If the comments are long then I have to scroll to read
all the comments. The problem am having is that if I
click in txtDisplay in an attempt to scroll the data in
txtDisplay disappears.

It seems that beacuse txtDisplay is poputated by code
clicking in this txtBox after it is populated cause the
values to disappear when the txtDisplay gets focus.

How can I get areound this.
 
do you have any events on txtdisplay? i.e. is there any code under txtdisplay_enter/txtdisplay_gotfocus/etc..

----- tim johnson wrote: ----

I have a listbox named lstDisplay on a form. When I
click the list box the following procedure is executed
that populates an unbound textbox named txtDisplay on the
same form


Private Sub lstDisplay_Click(

strSQL = "SELECT CommentDate, Comments FROM
tblCustomerComments " &
"WHERE CustomerCommentsID = " & lstDispla
Set rst = New ADODB.Recordse
Set cnn = CurrentProject.Connectio

rst.Open strSQL, cnn, adOpenKeyset, , adCmdTex
txtDisplay = rst!CommentDate & ": " & rst!Comment
rst.Clos
Set rst = Nothin


End Sub




You notice I am concatanating 2 fields from
tblCustomerComments, CommentDate and Comments then
displaying them in the unbound control, txtDisplay

If the comments are long then I have to scroll to read
all the comments. The problem am having is that if I
click in txtDisplay in an attempt to scroll the data in
txtDisplay disappears

It seems that beacuse txtDisplay is poputated by code
clicking in this txtBox after it is populated cause the
values to disappear when the txtDisplay gets focus

How can I get areound this
 
No There are no events associated with this unbound text
box


-----Original Message-----
do you have any events on txtdisplay? i.e. is there any
code under txtdisplay_enter/txtdisplay_gotfocus/etc...
 
Back
Top