Textbox truncate

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a small app that is basically a catalog. When the user selects an item from a list box, it updates a description textbox with a description from an access db. Any description over 255 characters is truncated to 255. I have verified the access field is of type memo and the entire string is there. I have also tried setting the maxlength property to 700. It still truncates the text. Any Ideas? Here's the code that does the update

Private Sub Trans_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Trans.SelectedValueChange
Dim i As Double =
Dim descstring As Strin
If Trans.Text <> "No Transmissions Found" The
Desc.Clear(
Me.List1.Items.Clear(
DA = New OleDb.OleDbDataAdapter("select distinct cat_desc from [desc] where stocknum = '" & Trans.Text & "'", Dataconn
DA.Fill(Rst
If Rst.Rows.Count = 0 The
Desc.Text = "Description not available
Button3.Visible = Fals
Els
descstring = Trans.Text & " - " & (Rst.Rows(i)("cat_desc")
Desc.Text = descstrin
Rst.Clear(
DA = New OleDb.OleDbDataAdapter("select stocknum from [image] where stocknum = '" & Trans.Text & "'", Dataconn
DA.Fill(Rst
If Rst.Rows.Count = 0 The
Button3.Visible = Fals
Els
Button3.Visible = Tru
End I
End I
Rst.Clear(
End I
i =
Me.List1.Items.Clear(
If IsDBNull(Me.Engine.Text) = False The
DA = New OleDb.OleDbDataAdapter("SELECT Tag " &
" FROM query1 WHERE Stocknum = '" & Trans.Text & "' ", Dataconn
DA.Fill(Rst
If Rst.Rows.Count = 0 The
List1.Items.Add("No code numbers found."
Els
Do While i < Rst.Rows.Coun
List1.Items.Add(Rst.Rows(i)("tag")
i +=
Loo

Rst.Clear(
End I
End I
Me.list1label.Text = "Transmission Code Numbers
End Sub
 
Check your schema for Rst (your dataset?), see if your limitation is there.

plus, what is the point of select distinct in that one query for the
cat_desc, it doesn't do anything... or at least I would HOPE it doesn't...



Ben Gulley @aaronsap.com> said:
I have a small app that is basically a catalog. When the user selects an
item from a list box, it updates a description textbox with a description
from an access db. Any description over 255 characters is truncated to 255.
I have verified the access field is of type memo and the entire string is
there. I have also tried setting the maxlength property to 700. It still
truncates the text. Any Ideas? Here's the code that does the update:
Private Sub Trans_SelectedValueChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Trans.SelectedValueChanged
Dim i As Double = 0
Dim descstring As String
If Trans.Text <> "No Transmissions Found" Then
Desc.Clear()
Me.List1.Items.Clear()
DA = New OleDb.OleDbDataAdapter("select distinct cat_desc from
[desc] where stocknum = '" & Trans.Text & "'", Dataconn)
DA.Fill(Rst)
If Rst.Rows.Count = 0 Then
Desc.Text = "Description not available"
Button3.Visible = False
Else
descstring = Trans.Text & " - " & (Rst.Rows(i)("cat_desc"))
Desc.Text = descstring
Rst.Clear()
DA = New OleDb.OleDbDataAdapter("select stocknum from
[image] where stocknum = '" & Trans.Text & "'", Dataconn)
 
Found the issue. Like CJ said, the distinct is the issue. Too close to the code to see it I guess. Looks like the ODBC driver translates memo fields as text. This allows the distinct and returns text, but only the first 255 chars. Would never get away with a distict on a memo field directly in Access.

Go figure..

Thanks CJ
Ben
 
np.

Ben Gulley said:
Found the issue. Like CJ said, the distinct is the issue. Too close to
the code to see it I guess. Looks like the ODBC driver translates memo
fields as text. This allows the distinct and returns text, but only the
first 255 chars. Would never get away with a distict on a memo field
directly in Access.
 
Back
Top