G
Guest
I have the following subroutime that writes a record to a table. When the
assignment statement - ![ConcWithDrug] = myConcDrug - is executed, the
field in the recordset is padded with blanks or unprintable characters. The
field that has the original value has no extra characters (I know this from
viewing the values in Debug mode).When I later read the value from the table
and include it in a string that gets printed in a messagebox, it prints those
extra characters, even if I do a Trim. Any ideas why this would happen?
Here's the subroutine. I've NEVER had this happen before and don't have a
clue!
Public Sub WriteConc(ByVal itemID As Long, ByVal myConcDrug As String, _
ByVal sameBag As Boolean)
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.Open "tblItemsConc", cn, adOpenKeyset, adLockOptimistic, adCmdTable
With rst
.AddNew
![ConcItemID] = itemID
![ConcWithDrug] = myConcDrug
If sameBag Then
![ConcType] = "S"
End If
.Update
.Close
End With
End Sub
assignment statement - ![ConcWithDrug] = myConcDrug - is executed, the
field in the recordset is padded with blanks or unprintable characters. The
field that has the original value has no extra characters (I know this from
viewing the values in Debug mode).When I later read the value from the table
and include it in a string that gets printed in a messagebox, it prints those
extra characters, even if I do a Trim. Any ideas why this would happen?
Here's the subroutine. I've NEVER had this happen before and don't have a
clue!
Public Sub WriteConc(ByVal itemID As Long, ByVal myConcDrug As String, _
ByVal sameBag As Boolean)
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.Open "tblItemsConc", cn, adOpenKeyset, adLockOptimistic, adCmdTable
With rst
.AddNew
![ConcItemID] = itemID
![ConcWithDrug] = myConcDrug
If sameBag Then
![ConcType] = "S"
End If
.Update
.Close
End With
End Sub