Ole object dialog box contolling

Option Compare Database

Private Sub cmdInsertFileInOleObject_Click()

'******************************************************
'******************************************************
'*********** *********
'***********-1- Define text box color *********
'*********** *********
'******************************************************
'******************************************************


Dim MyColor As Long
MyColor = RGB(255, 255, 255)
Me!cbxDocumentID.BackColor = MyColor '--------1
'******************************************************
'******************************************************
'*********** *********
'*********** inserting object processing *********
'*********** *********
'******************************************************
'******************************************************
Dim conUserCancelled As Integer
'.............................................................
'////////// Error message returned when user cancels ///////
'.............................................................
conUserCancelled = 2001
On Error GoTo ButtonErr
'.............................................................
'////////// Inserting OLE document ///////////
'.............................................................
Dim objWord As Object
oleFTransfDocument.SetFocus
DoCmd.RunCommand acCmdInsertObject
'oleFTransfDocument.InsertObjDlg
With objWord

oleFTransfDocument.OLETypeAllowed = acOLELinked
' Specify source file.
oleFTransfDocument.SourceDoc = "C:\"
oleFTransfDocument.Action = acOLECreateFromFile
' Create linked object.
oleFTransfDocument.Action = acOLECreateLink
oleFTransfDocument.Action = acolelocate

' Adjust control size.
oleFTransfDocument.SizeMode = acOLESizeZoom
End With
'.............................................................
'////////// Error message returned when user cancels OLE inserting ///////
'.............................................................
ButtonErr:
If Err = conUserCancelled Then ' Display message.
Status = MsgBox("You clicked the Cancel button; " & "no object was created.", vbOKOnly, "Cancelled")

End If
Resume Next

End Sub