Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 764
  • Last Modified:

Insert a file in a bound object frame

I want to insert a file ex. "c:\123.doc", in a automatic way, in i a bound object frame.
I have a record number, example  123, where I input various infos, then in this record (table) I need to insert (OLE) a file, but I don't want to use the keyboard or the mouse to do it. I want that this is made automatic.
Can you help me? The dabase picks the file in the positions identified by me and thens inserts it in the object frame.

Thanks,

Paulo Marques

0
paulo72
Asked:
paulo72
  • 2
1 Solution
 
svenkarlsenCommented:
Hi paulo72,

Example:

If you make a form with a bound object frame called BF1 and a button, then put these lines in the OnClick event code of the button:

Me.BF1.Class = "Word.document"
Me.BF1.OLETypeAllowed = acOLEEmbedded
Me.BF1.SourceDoc = "c:\test.doc"
Me.BF1.Action = acOLEEmbed

This will insert the document c:\test.doc in the frame.


Kind regards,
Sven
0
 
inoxCommented:

Create/use a table with an "OLE Object" type field.

design a form and insert a <Bound Object Frame> named eg "OLEFile" and a <textbox> named eg "txt1" for the filename and a <command button> named eg "Command1".
define a commandhandler for Button1 and write :

Private Sub Command1_Click()
  [OLEFile].Class = "Word.Document"
  [OLEFile].OLETypeAllowed = acOLEEmbedded
  [OLEFile].SourceDoc = [txt1]
  [OLEFile].Action = acOLECreateEmbed
  DoCmd.RunCommand acCmdRecordsGoToNew
End Sub

now the file is saved in the database.
0
 
inoxCommented:

Hi svenkarlsen
again the same thing, I have to become faster   :-(
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now