ACC: How to Use SendKeys in a Macro to Change an OLE LinkID: Q94040
|
Advanced: Requires expert coding, interoperability, and multiuser skills.
This article describes two methods to automate the changing of a linked
object's source. The first method is to use a macro, and the second method
is to use OLE Automation, which is available in Microsoft Access version
2.0.
Table: Linked References
------------------------
Field Name: Key
Data Type: Counter
Field Name: File Name
Data Type: Text
Field Name: Linked Object
Data Type: OLE Object
Key Filename Linked Object
--------------------------------------------------
(counter) ARCADE.BMP Paste Link ARCADE.BMP
(counter) ARCHES.BMP Paste Link ARCHES.BMP
(counter) ARGYLE.BMP Paste Link ARGYLE.BMP
Action Arguments
----------------------------------------------------------
GoToControl Control Name: Linked Object
SendKeys Keystrokes: %eol
Wait: No
SendKeys Keystrokes: =Forms![OLE Test]![File Name]
Wait: No
SendKeys Keystrokes: {ENTER}
Wait: No
In Microsoft Access version 2.0:
Action Arguments
----------------------------------------------------------
GoToControl Control Name: Linked Object
SendKeys Keystrokes: %ekl%c
Wait: No
SendKeys Keystrokes: =Forms![OLE Test]![File Name]
Wait: No
SendKeys Keystrokes: {ENTER}{ENTER}
Wait: No
Sub File_Name_AfterUpdate ()
Const OLE_LINKED = 0
Const OLE_CREATE_LINK = 1
Const OLE_SIZE_ZOOM = 3
[Linked Object].OLETypeAllowed = OLE_LINKED ' Object type allowed
[Linked Object].SourceDoc = [File Name] ' Specify source file
[Linked Object].Action = OLE_CREATE_LINK ' Create linked object
[Linked Object].SizeMode = OLE_SIZE_ZOOM ' Adjust control size
End Sub
Microsoft Access "User's Guide," versions 1.0 and 1.1, Chapter 13
Microsoft Access "User's Guide," version 2.0, Chapter 19
Microsoft Access "Building Applications," version 2.0, Chapter 13
Keywords : IntpOle
Version : 1.0 1.1 2.0
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: March 13, 1999