Subject | Problems with Odbc |
---|---|
Author | Carlo Pettirossi |
Post date | 2000-12-27T12:58:41Z |
Hi,
I would like to submit you some problems we encountered by using the ODBC drivers for interbase
During the copy of text values from the clipboard and by using the following VBA code (for Access 2000), the certain field in my DB is filled with null characters (mostly one or two but, in some records, the remaining space in the field is filled with them).
The code is the following:
Sub RemNullChr() 'uses DAO 3.6
Dim Dbs As Database, Rst As Object, j As Long, ID As Long
Dim SQLStr As String, Stringa As String, Charfound As Long
Set Dbs = CurrentDb
On Error Resume Next
With Dbs
SQLStr = "SELECT products.id as ID, PRODUCTS.DESCRIPTION as DESCRIPTION, PRODUCTS.DESCRIPTION2 as DESCRIPTION2 FROM Products"
' the fields Description and Description2 contain text (VarChar(5000))
Set Rst = .OpenRecordset(SQLStr, dbOpenDynaset)
While Not Rst.EOF
Rst.Edit
ID = Rst.Fields("id").Value
Stringa = Rst.Fields("Description").Value
Charfound = InStr(1, Stringa, Chr(0))
If Charfound > 0 Then
Debug.Print ID, Charfound
Stringa = Left(Stringa, Charfound - 1)
Rst.Fields("Description2").Value = "" 'through this one the null Char won't be added
Rst.Fields("Description2").Value = Stringa ' The null char will be added at the end of the string
End If
Rst.Update
Rst.MoveNext
Wend
End With
End Sub
Moreover, I noticed that some words in the field "DESCRIPTION" are cut, thus, I write or copy from the clipboard into a text box control in a Access 2000 form which is bound to that field. After finishing the copy-paste/write operation, I check out what I have done inside Access (by using the navigation buttons on the form). Everything seems to be all right.
Several days later a further check fails because of word cutting (and/or as described above, because of null chars placed at the end of the string). In the meanwhile in those records nothing else is modified by any other user.
Thanks in advance for your reply.
Best regards
Carlo Pettirossi
I would like to submit you some problems we encountered by using the ODBC drivers for interbase
During the copy of text values from the clipboard and by using the following VBA code (for Access 2000), the certain field in my DB is filled with null characters (mostly one or two but, in some records, the remaining space in the field is filled with them).
The code is the following:
Sub RemNullChr() 'uses DAO 3.6
Dim Dbs As Database, Rst As Object, j As Long, ID As Long
Dim SQLStr As String, Stringa As String, Charfound As Long
Set Dbs = CurrentDb
On Error Resume Next
With Dbs
SQLStr = "SELECT products.id as ID, PRODUCTS.DESCRIPTION as DESCRIPTION, PRODUCTS.DESCRIPTION2 as DESCRIPTION2 FROM Products"
' the fields Description and Description2 contain text (VarChar(5000))
Set Rst = .OpenRecordset(SQLStr, dbOpenDynaset)
While Not Rst.EOF
Rst.Edit
ID = Rst.Fields("id").Value
Stringa = Rst.Fields("Description").Value
Charfound = InStr(1, Stringa, Chr(0))
If Charfound > 0 Then
Debug.Print ID, Charfound
Stringa = Left(Stringa, Charfound - 1)
Rst.Fields("Description2").Value = "" 'through this one the null Char won't be added
Rst.Fields("Description2").Value = Stringa ' The null char will be added at the end of the string
End If
Rst.Update
Rst.MoveNext
Wend
End With
End Sub
Moreover, I noticed that some words in the field "DESCRIPTION" are cut, thus, I write or copy from the clipboard into a text box control in a Access 2000 form which is bound to that field. After finishing the copy-paste/write operation, I check out what I have done inside Access (by using the navigation buttons on the form). Everything seems to be all right.
Several days later a further check fails because of word cutting (and/or as described above, because of null chars placed at the end of the string). In the meanwhile in those records nothing else is modified by any other user.
Thanks in advance for your reply.
Best regards
Carlo Pettirossi