Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE Error 2753

Status
Not open for further replies.

dmh4ab

Programmer
Oct 2, 2002
53
US
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 <> &quot;&quot; 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
 
you are sending something fluucky to the compiler. Do and MSGBOX on strPath and you will see it.

rollie@bwsys.net
 
Thanks Rolliee. I tried that and the path looks completely normal. (C:\Documents and Settings\e164735\My Documents\courses.xls). I also tried a path that has no spaces in the folder names. Same result.

dmh4ab
 
Okay!!!!

YOu may need a chr(34) in front of the string and a chr(34) behind. The string you showed me here does not have quotes - thus the chr(34)


rollie@bwsys.net
 
Thanks again Rolliee.
This gave me Run-time error 2101: &quot;The setting you entered isn't valid for this property.&quot; It occurs when assigning the sourcdoc to the ole object. Seems Access automatically appends the &quot; to the string as two showed up in the debug window.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top