Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need HELP with Images and Access97

Status
Not open for further replies.

Ferlin

Programmer
Jan 18, 2001
71
US
Please help this Newbee,

I have searched the Forum and was unable to find an answer.

I am trying to take an image from an Access97 database (.mdb) and place it
in an image control. Here is some of the code I am trying to use.
I am getting an Invalid Picture error, Any and All help would be greatly
appreciated by this NEWB.
Code:
Option Explicit

Dim mIPicture As Variant
Dim FileNum As Integer
Dim DiskFile As String
     .
     .
     .
Private Sub LoadControls()

  With mrsITEM
      txtItemNumber = !ItemNumber & ""
      rchtxtDescription = !Description & ""
      txtRetailPrice = !RetailPrice & ""
      txtWhitePrice = !WhitePrice & ""
      txtYellowPrice = !YellowPrice & ""
      txtBluePrice = !BluePrice & ""
      txtWOPPageNumber = !WOPPageNumber & ""
  End With

     FileNum = FreeFile

     Me.MousePointer = vbHourglass

     ' Remove any existing destination file.
     DiskFile = App.Path & "\data\pictemp.bmp"

     If Len(Dir$(DiskFile)) > 0 Then
       Kill DiskFile
     End If

     Open DiskFile For Binary As FileNum

     mIPicture =
     mrsITEM!ItemPicture.GetChunk(mrsITEM!ItemPicture.ActualSize)
     Put FileNum, , mIPicture

     Close FileNum
     Image1.Picture = LoadPicture(DiskFile)
Invalid Picture Error.
Code:
     Me.MousePointer = vbArrow
End Sub
As a NOTE if it makes any difference. The ActualSize shows as 840066, but the pictemp.bmp file is 840078 exactly 12 bytes greater.

Sample Code would be a Life Saver.

Thanks in Advance,

Ferlin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top