Link to home
Start Free TrialLog in
Avatar of i950
i950

asked on

How can I convert a Binary field to Long binary data?

Hello,

The title says it all...

Please help. Thanks.
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

is this field in an access table?
Avatar of i950
i950

ASKER

Yes.
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of i950

ASKER

I'm a beginner... where should I run that code?

Thanks.
you can place the codes in a  click of a command button in a form

private sub command0_click()

currentdb.execute "alter table NameOfTable alter column binaryfieldname longbinary"

end sub

do you know how to create button in a form?
what is the name of the table? the name of the field?


Avatar of i950

ASKER

I think I was able to run the code but nothing changed. It still showing "Binary" not "long binary data"

Thanks.
can you post the codes that you use, all of it
Avatar of i950

ASKER

Here it is:

Option Compare Database

Private Sub Option4_Click()

currentdb.execute "alter table ev1 alter column binp longbinary"

End Sub

It's on the Click event or a radio button.
you should see  Ole Object in the data type column when you open the table in design view.

check again.
Avatar of i950

ASKER

I do.. but when I double click the table it's showing "Binary" only.

The reason I want to change it to long binary data is the long binary data is byte by byte the same as the file that was entered in the database. When a file is saved as Binary only, chars are being added at the beginning of the file and when I'm extracting the files it's being corrupted.
The LONGBINARY data field is used to store graphic image data and allows any alphanumeric data to be entered and saved.

don't double click the table.
select the table and click Design from the database objects menu.
now look for the field  {binp } and see what is written in the Data Type column
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
try

Option Compare Database

Private Sub Option4_Click()

currentdb.execute "alter table ev1 alter column binp longbinary"

msgbox "Code was run"         '<--- you should get this message

End Sub
Avatar of i950

ASKER

> don't double click the table.
> select the table and click Design from the database objects menu.
> now look for the field  {binp } and see what is written in the Data Type column

It's written OLE Object

> msgbox "Code was run"         '<--- you should get this message

I got that message

Please help. Thank you.
It's written OLE Object  <--- this is Long Binary
Avatar of i950

ASKER

When I double click it, it says "Binary", I have tables when I double click on them I see "long binary data" and those work with my application while "Binary only doesn't work.

Any idea how convert them "completely" to "long binary data"?
well, i guess you my have lost some information when the data was entered to the binary field.
try the conversion of the field to Long Binary in an empty table and fill the field with long binary data.
Avatar of i950

ASKER

I didn't lose anything, but Binary field adds some additional info at the beginning of the file, and when I read it using a programming language and then write it to disk I get unnecessary information at the beginning of the file that is corrupting it :(
Did we get a resolution to this question?

mx
Avatar of i950

ASKER

?