I am trying to read/write MEMO type field from an Access 2.0 file using ADODB. I can write data into the MEMO field - more than 255 characters (when I open converted file in Access I can see all data that is supposed to be there), but I cannot read more than 255 characters using the VB6 code as bellow. rst("Opis")
is the memo field I am interested in:
Set db = New ADODB.Connection
db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & T_BAZA & ";Persist Security Info=False"
Set rst = New ADODB.Recordset
SQL = "SELECT DISTINCT Opis FROM JadlospisSzczegoly WHERE Opis IS NOT NULL AND NazwaJadlospisu='" & LCase(Me.Combo3.Text) & "' AND Dzien=" & t_Dzien & " AND Posilek=" & t_Posilek
rst.Open SQL, db, adOpenStatic, adLockOptimistic, adCmdText
Do While Not rst.EOF
Me.RichTextBox1.Text = Trim$(rst("Opis"))
rst.MoveNext
Loop
Any ideas on how to solve this problem?
I have found the issue. DISTINCT in SQL query was the problem. I have read that DISTINCT with memo datatype does not work as it should be.
When I have removed it, all characters from the MEMO filed were displayed.
Try the GetChunk() method:
Do While Not rst.EOF
If rst.Fields("Opis").ActualSize > 0 Then
Me.RichTextBox1.Text = rst.Fields("Opis").GetChunk(rst.fields("Opis").ActualSize)
Else
Me.RichTextBox1.Text = "n/a"
End If
rst.MoveNext
Loop
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With