Link to home
Start Free TrialLog in
Avatar of tjikkun
tjikkun

asked on

run-time error 2753

Hello experts,
We have a database system at our company that was created for access 97 I think. It has been upgraded with some minor adjustments to 2000, and now to 2003. There are only 2 issues still remaining. I will ask the first one here.
There is a possibility to select an image to display for a company in the database. This always used to work but now with Access 2003 I get:

Run-time error '2753'

A problem occured while <name of DB> Database was communicating with the OLE server or ActiveX Control.

I don't have much VB knowledge, so i don't know what to do. When I press debug I see the following code gives the error:

*************************************
Private Sub cmdSelectBigLogo_Click()
Dim strFileName As String

strFileName = SelectPicture()

Me.logo.Locked = False
Me.logo.Enabled = True
If Not strFileName = "" Then
    Me.logo.SourceDoc = strFileName
    Me.logo.Action = acOLECreateEmbed <- *** at this line it gives the error ***
End If
Me.cmdSelectBigLogo.SetFocus
Me.logo.Enabled = False
Me.logo.Locked = True
Me.logo.SizeMode = 1
Exit Sub

errortrap:
MsgBox "There was an error selecting the image.", vbCritical, "Image selection"

End Sub
*************************************

I hope someone can help me with this problem.
Thanks for reading my question anyway,

Sander Hoentjen
Avatar of Flembosa
Flembosa

What is logo? A picture box a recordset?
Avatar of tjikkun

ASKER

Well my guess would be a picture box. How can I find out?
Go to the form and there will be a list of controls in a combobox on the right side of the screen. Look for logo and see what it says next to it. Another way would be to right click on logo, and select definition.
Avatar of tjikkun

ASKER

BoundObjectFrame is what is says somewhere. Is that what you need to know?
I couldn't get it to work with an Unbound Object Frame, but when I replaced it with a Bound Object Frame the same code worked.
Avatar of tjikkun

ASKER

ehh? but I allready have a Bound Object Frame, right?
you said your object was an Unbound Object Frame.

You would have to delete your Unbound Object Frame and Create a Bound Object Frame and name it "logo"

I would suggest using a copy so incase it doesn't work you can revert back to the other.
Avatar of tjikkun

ASKER

Well I did not get an answer that was useful for me. So my recommendation is a refund.
Thanks to Flembosa for trying to help.
Thanks, Did you end up getting it to work?
Avatar of tjikkun

ASKER

nope.. still searching
I take it you are trying to display a picture on your form.

I just tried this and it worked:

I drew an imagebox on the form. It made me select a picture to put in it, so I chose one.
Then I right clicked on the Imagebox and went to the Picture property and erased the path.

Private Sub cmdSelectBigLogo_Click()
Dim strFileName As String

strFileName = SelectPicture()

If Not strFileName = "" Then
   Image1.Picture = strFileName
   Image1.SizeMode = 1 'This will stretch the picture
End If

Exit Sub

errortrap:
MsgBox "There was an error selecting the image.", vbCritical, "Image selection"

End Sub

Hope this helps.

Flem
Avatar of tjikkun

ASKER

Image1 is not defined
It is a form where a user can choose the picture, that picture shows up in several places
ASKER CERTIFIED SOLUTION
Avatar of Flembosa
Flembosa

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tjikkun

ASKER

ok.. that seems to work..
Now the picture has to show in different places, can i do the same everywhere? (insert a new picture and rename it)
Yes, like this:

Private Sub cmdSelectBigLogo_Click()
Dim strFileName As String

strFileName = SelectPicture()

If Not strFileName = "" Then
   Image1.Picture = strFileName
   Image1.SizeMode = 1 'This will stretch the picture
   Image2.Picture = strFileName
   Image2.SizeMode = 1 'This will stretch the picture
End If

Exit Sub

errortrap:
MsgBox "There was an error selecting the image.", vbCritical, "Image selection"

End Sub
Avatar of tjikkun

ASKER

Ok, I have the problem that the picture is gone the next time I start the database. You know how to solve that?
There are two ways to go about saving the picture to the database. You can either save the path to the picture in the field or save the actual picture in the database.

My suggestion would be to post this as a new question.
Flem
Avatar of tjikkun

ASKER

Well, getting the picture in the database is what this question is about.. It always used to work, but not anymore. So I feel this question is only answered when that is done. But If you answer it I will post another question for you just for points.
so what i have now is:
Private Sub cmdSelectBigLogo_Click()
Dim strFileName As String

strFileName = SelectPicture()
MsgBox strFileName
If Not strFileName = "" Then
    logobig2.Locked = False
    logobig2.Enabled = True
    logobig2.SourceDoc = strFileName
    logobig2.Action = acOLECreateEmbed

where logobig2 is a bound object frame i created
only on the last line the system hangs, or at least access does, this was the line it used to give the error on.
Avatar of tjikkun

ASKER

Ok,
I have been on holiday, now I got i somewhat working, partly thanks to the directions posted here, so the points go to you.

Thanks for all the help