Importing JPG

Blanic

Registered User.
Local time
Today, 13:08
Joined
Jul 8, 2001
Messages
11
Can someone tell me how to import a .jpg into the database by clicking on a single button. I want to import it from a directory such as c:\temp and the file like test.jpg
I know that it will require VBA to do it, but I cannot find the command to copy a .jpg into an OLE object, which is what I can do but I do it by clicking on the photo and right mouse and hit copy, then click on the database OLE object and hit paste and it imports the picture, im needing it to be automated
THANKS
 
You want to Use the Action Property to Link/Embed. The Help file has an example.

HTH
 
I have exactly the same problem...so if you come up with a solution could you please let me know.

THANKS.
 
Heres some code I came up with, follow the instructions from Microsoft at this link,
http://support.microsoft.com/support/kb/articles/Q209/9/90.ASP?LN=EN-US&SD=gn&FR=0&qry=OLE%20class%20name&rnk=2&src=DHCS_MSPSS_gn_SRCH&SPR=ACC2000

and add my code.
Private Sub cmdOLEAuto_Click()
On Error GoTo Error_cmdOLEAuto_Click
With Me![Pic]
.Enabled = True
.Locked = False
' Specify what kind of object can appear in the field.
.OLETypeAllowed = acOLEEmbedded
' Class statement for Word document.
.Class = "Word.Picture"
' Specify the file to be embedded.
' Type the correct path name.
.SourceDoc = "c:\test.jpg"
' 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
 

Users who are viewing this thread

Back
Top Bottom