smartpi
August 20th, 2001, 08:27 PM
I need to open a binary file and save it to an access 4.0, but I can't figure out how to open it in a way that I can then move it into an ado recordset.
|
Click to See Complete Forum and Search --> : opening binary file smartpi August 20th, 2001, 08:27 PM I need to open a binary file and save it to an access 4.0, but I can't figure out how to open it in a way that I can then move it into an ado recordset. Iouri August 21st, 2001, 07:01 AM Function FileText(ByVal filename As String) As String Dim handle As Integer ' ensure that the file exists If Len(Dir$(filename)) = 0 Then Err.Raise 53 ' File not found End If ' open in binary mode handle = FreeFile Open filename$ For Binary As #handle ' read the string and close the file FileText = Space$(LOF(handle)) Get #handle, , FileText Close #handle End Function now add this to your recordset Iouri Boutchkine iouri@hotsheet.com smartpi August 22nd, 2001, 05:57 AM Thanks, that worked and showed me that I didn't know how to save a binary file to an OLE field. I tried to do the way I save and transfer other fields: adorec!Picture = bFile I called your function like this: Call FileText(bFile) It might be because I need to dim bFile as a Variant, I'll try it tonight. Iouri August 22nd, 2001, 07:30 AM Rate it if it helped you Iouri Boutchkine iouri@hotsheet.com codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |