D
DoubarSingh
For handy display I developed a segment of VBA ADO codes to view th
fields from an Interbase database. It worked fine for most essentia
fields. Until recently I want to include the memo BLOB field. I
displays nothing when I copy straightly from the dataset to the cell.
And it displays garbage when I first copy from the dataset to a strin
variable and then place into the cell.
I suspect there should be a data definition for the memo field but
can not find it from the help topics. Any one can tell me how, an
where to get VBA manuals relate to these issues?
THX!
The following is a seqment of the coding:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim numberOfRows As Integer
Dim stmtSQL
Dim ChgBkDt As String
Dim RemarkField As String
ChgBkDt = Cells(2, 3).Value
Range("a1").Select
' Open the connection.
Set cn = New ADODB.Connection
cn.Open "DRIVER={XTG Systems InterBase6 ODB
driver};DB=200.xx.1xx.25x:\hshome\cdest\Def\GBSTINFO.GDB;UID=cdestm;PWD=btyrrb;"
'' Set the command text.
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = cn
stmtSQL = "SELECT * "
stmtSQL = stmtSQL & "FROM MAIN c, FOLKREMARK t WHERE CATDATE lik
'%" & ChgBkDt & "'"
stmtSQL = stmtSQL & " AND c.REFR = t.REFR order by CATNO"
With cmd
.CommandText = stmtSQL
.CommandType = adCmdText
.Execute
End With
'' Open the recordset.
Set rs = New ADODB.Recordset
' Set rs.ActiveConnection = cn
rs.Open cmd
Cells(6, 2).CurrentRegion.Clear
' numberOfRows = Cells(6, 2).CopyFromRecordset(rs)
' ...... and other coding here
Cells(8, 2).Value = rs("certno")
Cells(8, 3).Value = rs("memodate")
RemarkField = rs("Remarks")
Cells(8, 4).Value = RemarksField
Cells(1, 3).Select ' reset cursor cell
Set cmd = Nothing
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothin
fields from an Interbase database. It worked fine for most essentia
fields. Until recently I want to include the memo BLOB field. I
displays nothing when I copy straightly from the dataset to the cell.
And it displays garbage when I first copy from the dataset to a strin
variable and then place into the cell.
I suspect there should be a data definition for the memo field but
can not find it from the help topics. Any one can tell me how, an
where to get VBA manuals relate to these issues?
THX!
The following is a seqment of the coding:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim numberOfRows As Integer
Dim stmtSQL
Dim ChgBkDt As String
Dim RemarkField As String
ChgBkDt = Cells(2, 3).Value
Range("a1").Select
' Open the connection.
Set cn = New ADODB.Connection
cn.Open "DRIVER={XTG Systems InterBase6 ODB
driver};DB=200.xx.1xx.25x:\hshome\cdest\Def\GBSTINFO.GDB;UID=cdestm;PWD=btyrrb;"
'' Set the command text.
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = cn
stmtSQL = "SELECT * "
stmtSQL = stmtSQL & "FROM MAIN c, FOLKREMARK t WHERE CATDATE lik
'%" & ChgBkDt & "'"
stmtSQL = stmtSQL & " AND c.REFR = t.REFR order by CATNO"
With cmd
.CommandText = stmtSQL
.CommandType = adCmdText
.Execute
End With
'' Open the recordset.
Set rs = New ADODB.Recordset
' Set rs.ActiveConnection = cn
rs.Open cmd
Cells(6, 2).CurrentRegion.Clear
' numberOfRows = Cells(6, 2).CopyFromRecordset(rs)
' ...... and other coding here
Cells(8, 2).Value = rs("certno")
Cells(8, 3).Value = rs("memodate")
RemarkField = rs("Remarks")
Cells(8, 4).Value = RemarksField
Cells(1, 3).Select ' reset cursor cell
Set cmd = Nothing
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothin