It's nothing to programmatically insert the Bitmap file into the OLE
field.
Here's a sample for a Word Doc. You'll have to change it support MS Paint
BMP's instead which would be class "Paint.Picture". As teh sampel
indicates,
you will need a Bound OLE Frame control on your form. You can make it
hidden
if you don't want the user to see it at this point in your UI.
Private Sub cmdOLEAuto_Click()
On Error GoTo Error_cmdOLEAuto_Click
With Me![OLEWordDoc]
.Enabled = True
.Locked = False
' Specify what kind of object can appear in the field.
.OLETypeAllowed = acOLEEmbedded
' Class statement for Word document.
.Class = "Word.Document"
' Specify the file to be embedded.
' Type the correct path name.
.SourceDoc = "c:\<pathname>\TestOLEAuto.doc"
' Create the embedded object.
.Action = acOLECreateEmbed
' Optional size adjustment.
.SizeMode = acOLESizeZoom
End With
Exit_cmdOLEAuto_Click:
Exit Sub
Error_cmdOLEAuto_Click:
MsgBox CStr(Err) & " " & Err.Description
Resume Exit_cmdOLEAuto_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.
I have a folder full of flags each drawn as a bitmap. When I enter a
new
country into the Access database, I want to write a piece of software
in
VBA
to display the folder and the flags inside, then allow the user to
select
one
flag and have it automatically embedded in the relevant Access table in
the
correct place. The first two bits I can do, it is purely the
embeddidng
of
an external bitmap that is causing a problem.
Mike
:
What is it exactly you want to do?
--
HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
Stephen, then the next question is how do I mimic drag and drop in
VBA?
If I
drag a bitmap into the table in datasheet view, it says "Bitmap
Image"
and
displays correctly in a form, but if I set the cell equal to the
path
and
file name of the bitmap in VBA, the table says "Binary Information"
and
will
only display a blank.
Mike
:
For a form in Continuous view, the only method available involves
the
use
of
a Bound OLE Frame control, and as you surmised, embedded Images.
--
HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
Stephen, thank you, but that still means embedding the bitmaps
within
the
database. Is there a way of linking the bound object frame to
and
external
set of bitmaps?
:
I think you would have to create a seperate table with two
fields.
An
indexed key field representing the Country code and an OLE
object
field
where you would embed the small graphic for the respective flag.
Use a Query to produce the recordsource for the form linking
each
row
from
your main table to the "Flags" table containing the Bitmap.
--
HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
I have a continuous form to select a country and i want to add
a
small
bitmap
flag to each. How can I link a bound object frame to each
bitmap,
when
the
bound object frame does not seem to offer a suitable event on
which
to
hang
VBA?