Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Bitmap 2114 Microsoft Access doesn't support the format of the f Version: 2002 (10.0) XP

Avatar of Deadcats
DeadcatsFlag for United States of America asked on
Microsoft Access
36 Comments1 Solution2308 ViewsLast Modified:
Hello All,

I have been trying to get what I thought was something simple.

I’m trying to copy a bitmap from one Image control to another below is my code and I know I don’t have to use the packString and unPackString in this example. In real life I need to. So I’m hoping that someone can show me the error of my ways so to speak.

My code is below

Thanks
Art


Option Compare Database
Option Explicit

Private Sub Command2_Click()
Dim bGIF1() As Byte
Dim bGIF2() As Byte
Dim strGif As String

On Error GoTo TrapError
bGIF1() = I1.Picture 'I1 is an Image control with an embedded bitmap image
' The Bitmap is C:\WINDOWS\Zapotec.bmp
packString bGIF1, strGif

unPackString strGif, bGIF2

Open "c:\ztest\xtest.gif" For Binary Access Write As #1 Len = UBound(bGIF2)
Put #1, 1, bGIF2
Close #1
'This is the line of code that generates teh error
i2.Picture = "c:\ztest\xtest.gif" 'I2 is another image contriol

'*************************************
' Error Number: 2114
' Error Description: Microsoft Access doesn't support the format of the file 'c:\ztest\xtest.gif,' so it can't load the picture.@@@1@@1
'*************************************


Exit Sub
TrapError:
Debug.Print Err.Number
Debug.Print Err.Description

End Sub


Sub unPackString(MyString As String, myByteArray() As Byte)

'Fills myByteArray with the bytes making up myString

ReDim myByteArray(Len(MyString))
Dim i As Integer

For i = 1 To Len(MyString)
myByteArray(i) = Asc(Mid$(MyString, i, 1))
Next

End Sub

Sub packString(myByteArray() As Byte, MyString As String)

'Fills myString with the bytes making up myByteArray
Dim i As Integer

MyString = ""
For i = 1 To UBound(myByteArray)
MyString = MyString & Chr$(myByteArray(i))
Next

End Sub
ASKER CERTIFIED SOLUTION
Avatar of Leigh Purvis
Leigh PurvisFlag of United Kingdom of Great Britain and Northern Ireland imageDatabase Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 36 Comments.
See Answers