Displaying Binary Data

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

Guest

I need to display the binary data type from a SQL Sever database, but this is
a problem according to Knowledge Base article # 208900. There does not seem
to be an Access built in function, so does that mean I have to write my own?
If so, would an approach be to convert it to text/hex string then use the Hex
function on that? Thanks.
 
Here is a previous post of mine on this subject. Obviously you will need
to change the file type extension to match that of the original file
that you inserted into your SQL table.

From: Stephen Lebans
([email protected])
Subject: Re: 2003 and Long Binary Data


View this article only
Newsgroups: comp.databases.ms-access
Date: 2004-11-21 16:37:33 PST


Have you tried saving the contents of the field to a disk file and then
trying to load the file in Excel. I say this because the original Excel
file may have been inserted as binary data.

Create a form with an OLE Frame control bound to the field in question.

Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click

Dim a() As Byte
Dim lTemp As Long
Dim sl As String

lTemp = LenB(Me.olePicture.Value)
ReDim a(0 To lTemp) ' should be -1

' Copy the contents of the OLE field to our byte array
a = Me.olePicture.Value

sl = "OLEfieldTestExcel" & ".xls"
Open sl For Binary Access Write As #1
Put #1, , a
Close #1

Exit_cmdSave_Click:
Exit Sub

Err_cmdSave_Click:
MsgBox Err.Description
Resume Exit_cmdSave_Click

End Sub



--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Back
Top