Solved

Insert a file in a bound object frame

Posted on 2003-11-10
3
707 Views
Last Modified: 2009-10-08
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
Comment
Question by:paulo72
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
svenkarlsen earned 125 total points
ID: 9714450
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
 
LVL 4

Expert Comment

by:inox
ID: 9714578

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
 
LVL 4

Expert Comment

by:inox
ID: 9714591

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

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now