I have a form with a button to attach a file into an OLE object. However, when the button is clicked it gives me the error "Run-time Error '2753':
A problem occurred while Microsoft Access was communicating with the OLE server. Close the OLE server and restart it outside of Microsoft Access. Then try the original operation again in Microsoft Access."
Microsoft suggests the problem is created by populating the bound OLE object in the BeforeUpdate event, but my code is in a button_click event. I've seen several posts related to this error, but never a solution.
Code follows:
Private Sub cmdAttach_Click()
'Open a common dialog box to select a file and attach it to the record
'as a link in a bound OLE field
Dim strPath As String
Me!CommonDialog.FileName = ""
Me!CommonDialog.ShowOpen
strPath = Me.CommonDialog.FileName
If strPath <> "" Then
Me!OLEBound_Drawing.OLETypeAllowed = acOLEEmbedded
Me!OLEBound_Drawing.SourceDoc = strPath
''''''''''''''''''''''''''''''''''''''''''''''''
'throws an error on line below
''''''''''''''''''''''''''''''''''''''''''''''''
Me!OLEBound_Drawing.Action = acOLECreateEmbed
End If
End Sub
I'd be grateful for any help.
Thanks,
dmh4ab
A problem occurred while Microsoft Access was communicating with the OLE server. Close the OLE server and restart it outside of Microsoft Access. Then try the original operation again in Microsoft Access."
Microsoft suggests the problem is created by populating the bound OLE object in the BeforeUpdate event, but my code is in a button_click event. I've seen several posts related to this error, but never a solution.
Code follows:
Private Sub cmdAttach_Click()
'Open a common dialog box to select a file and attach it to the record
'as a link in a bound OLE field
Dim strPath As String
Me!CommonDialog.FileName = ""
Me!CommonDialog.ShowOpen
strPath = Me.CommonDialog.FileName
If strPath <> "" Then
Me!OLEBound_Drawing.OLETypeAllowed = acOLEEmbedded
Me!OLEBound_Drawing.SourceDoc = strPath
''''''''''''''''''''''''''''''''''''''''''''''''
'throws an error on line below
''''''''''''''''''''''''''''''''''''''''''''''''
Me!OLEBound_Drawing.Action = acOLECreateEmbed
End If
End Sub
I'd be grateful for any help.
Thanks,
dmh4ab