Insert OLE

Surjer

Registered User.
Local time
Today, 08:50
Joined
Sep 17, 2001
Messages
232
This is where I stand...
My table has three feilds
[Name], [Sketch (BMP)], [File]
I want it to loop through and grab the [file] name for each record and embedd the appropriate [File] to the [Sketch (BMP)] Feild

Table:
Pictures
Feilds:
[Name] ' Key, String
[Sketch (BMP)] ' OLE Object
[File] ' String
Private Sub Command10_Click()
[Sketch (BMP)].[Class] = "Bitmap Image"
[Sketch (BMP)].OLETypeAllowed = acOLEEmbedded
[Sketch (BMP)].SourceDoc = [Sketch (BMP)].File]
[Sketch (BMP)].Action 'Don't know what
[Sketch (BMP)].SizeMode ' Don't know what
End Sub

The ultimate goal is to get it to loop through each record and insert the *.bmp base on the Feild [File] and I'm not even certain I am taking the correct approach at this.

Thanks in Advance...
Jerry
 
Just a thought.

Why not use the file path directly.

For example on a form add an OLE image. Set the path to nothing, and linked. Place a text box on the form to show the path name.

in the code behind the form type

me.img.picture=me.txtbox

this will populate the image on the form, without storing the bmp, and only storing a string.
 
surjer,

maybe this will get you started...

the following will insert the file "c:\SkFile.bmp" into the control [Sketch]...

[sketch].OLETypeAllowed = acOLEEmbedded
[sketch].SourceDoc = "c:\SkFile.bmp"
[sketch].Action = acOLECreateEmbed
[sketch].SizeMode = acOLESizeZoom

you should be able to replace "c:\SkFile.bmp" with the control that contains the full path to the .bmp file.

the size mode causes the image to 'zoom' to the size of the frame.

hth,
al

btw, the Class property is read only and is used to determine the class of an existing object. (i think)
smile.gif





[This message has been edited by pcs (edited 10-20-2001).]
 
Thanks PCS, Youre code worked perfect..

Now that I have the code for actually inserting the image my next challenge is to get the loop part....

It shouldn't be that hard...You took care of the hard part..

This is what I used...


Thanks Again..

Option Compare Database
Option Explicit
Public picPath As String
Private Sub Command8_Click()
With cm1 ' Common Dialog Control
.DialogTitle = "Choose Your Sketch (*.bmp) file to Import"
.CancelError = False
.Filter = "Bitmap Image (*.BMP)|*.BMP"
.ShowOpen
If Len(.FileName) = 0 Then
Exit Sub
End If
picPath = .FileName
End With

[Sketch].OLETypeAllowed = acOLEEmbedded
[Sketch].SourceDoc = picPath
[Sketch].Action = acOLECreateEmbed
[Sketch].SizeMode = acOLESizeStretch


End Sub
 
Surjer,

glad i got something right this week...
smile.gif


al
 
Question:

You created the following subroutine:

Option Compare Database
Option Explicit
Public picPath As String
Private Sub Command8_Click()
With cm1 ' Common Dialog Control
.DialogTitle = "Choose Your Sketch (*.bmp) file to Import"
.CancelError = False
.Filter = "Bitmap Image (*.BMP)|*.BMP"
.ShowOpen
If Len(.FileName) = 0 Then
Exit Sub
End If
picPath = .FileName
End With

[Sketch].OLETypeAllowed = acOLEEmbedded
[Sketch].SourceDoc = picPath
[Sketch].Action = acOLECreateEmbed
[Sketch].SizeMode = acOLESizeStretch


End Sub

You call it from an On_Click event of a button...
BUT...

Where does it paste the object to...?
I might be able to use code like this and am just curious...

Thanks a mil...
 
I used the Form Wizard to make a form from my table "Pictures"

This intern sets the recordsource and controlsource what have you! So the answer to youre question is:
It updates whatever record that the form is on!

Actually It updates the "Bound Object frame"? that the wizard created on the Form.

Does that make sence? If not just let me know and I'll send you the DB!!!

Not to good with Access Terms.....

[This message has been edited by Surjer (edited 10-22-2001).]
 
Please send me the DB...

I was wondering what [field] the code puts the OLE into...

randomblink@yahoo.com
 
Randomblink,

it puts the image in the control named [sketch]...you can replace [sketch] with [YourControl]...(must be an image type control)

al



[This message has been edited by pcs (edited 10-22-2001).]
 
I sent the DB!!!!!!!!

Don't forget to hold down shift~!!
 

Users who are viewing this thread

Back
Top Bottom