Avatar of sglee
sglee asked on

How to remove image from ACCESS FORM

Path to PictureHi,

 I am working on the ACCESS database that someone developed. Each form uses a certain kind of graphics file such as .jpg, .ico.
 Since I am working on this database from my work environment, whenever I tried to open any form, it hangs for a while looking for the graphics file which does not exist on my network.
 I try to remove it from the form property, but that is not easy either.
 Whenever I highlight  the whole path & graphics file name and press [Delete] key, it disappears, but as soon as I leave the field, then it comes right back.

 How can I remove the use of any graphics on the form?

Thanks.
Microsoft Access

Avatar of undefined
Last Comment
sglee

8/22/2022 - Mon
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

I've had this issue many times ... especially the one where it says the :OLE Server is not registered .... "  I use this code to get rid of the 'stuck' image:


Public Function DXM_zzDeleteImageOLE(sFrmName As String, ctlName As String) As String

    'This will get rid of a stuck OLE image on a form, wherein you get the message "OLE Server not registered ..."

    ' ?APP_zDeleteImageOLE("","")
    DoCmd.OpenForm sFrmName, acDesign
    DeleteControl sFrmName, ctlName
    DoCmd.Close acForm, sFrmName, acSaveYes
    DXM_zzDeleteImageOLE = "Control Deleted"
   

End Function

Pass (or hard code) the name of the Form and the Control Name.
ASKER
sglee

Maybe I was not clear what my problem was.

I do not get "OLD Server not registered..." message.

The path in the form property is correct and vaild in the production environment/network.
Since I took the copy of the database to do some work and tried to open the form on my network, it generates an error complaining that the folder/file don't exist, which makes perfect sense because simply the path don't exist.

The question is how can I remove it so that it does not look for any graphics.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Remove it ... from the Form Property sheet?
Using the code I supplied. Ignore my comment about OLE ....
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER
sglee

I created a module where put that function.
Then I created a macro that called that function, but it generated an error when I ran the macro.
Macro error1Macro error2Macro error3
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

You don't need a Macro, and you have to pass the Form Name and Control Name . or . just hard code the Form and Control Names.

You can run the code directly in the Module>>Function by hitting F5

Hard coded  version - just hit F5 to run

Public Function DXM_zzDeleteImage() As String

   Dim sFrmName As String
    sFrmName = "YourFormNameHere"

 
    DoCmd.OpenForm sFrmName, acDesign
    DeleteControl sFrmName, "YourControlNameHere"
    DoCmd.Close acForm, sFrmName, acSaveYes
    DXM_zzDeleteImageOLE = "Control Deleted"
   

End Function
ASKER
sglee

In your code, I just noticed  DeleteControl sFrmName, "YourControlNameHere".
Since it is in the form property, what would be the name of the control for that?
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

OK ... sorry ... I see it's only for the Form ...
Let me modify the code if I can ...
ASKER CERTIFIED SOLUTION
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
sglee

I ran the code against a couple of forms and it took longer time that I thought it would take, but it ran both times, but when I open those forms, I still get the error about the path not found.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Interesting.
It should only take a second literally. Opens in Design view, removes, closes w/save.
Any chance you can upload a db with this Form ... and be sure it has the issue?

mx
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ASKER
sglee

I would love to, but I can't due to confidentiality...

Is there a way to remove this by editing form properties manually?
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015

I have been following this.

I am curious and a few things.

1)  what is the database format( 2000, 2002/2003 .MDB or 2007 .ACCDB)?

2) What version of Access are you running including SP level and bits?

I have run into similar issues with Access 2010 trying to edit a 2002/2003 MDB that uses ULS for user log on tracking only if the correct .mdw is not used.
ASKER
sglee

1) it is mdb. so has to be 2003 or earlier. In fact this database was developed a few years ago. so my guess is probably right.
2) I am using a computer that has office 2003 pro. version simply because I can't get used to 2010 user interface.
3) this is a simply user .mdb database. no mdw is developed.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
sglee

I keep thinking it is a matter of removing those graphical stuff from the right properties.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

"'I would love to, but I can't due to confidentiality..."
Just this Form in an empty db ...
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

OK ... so, problem solved ?
My code set it to None.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER
sglee

Yes. The problem solved. Thank you.
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015

I suspect the time delay with MX's code was do the the path being invalid.

Glad you got it sorted out.
ASKER
sglee

There are two ways of doing it.
One way was to assign "None" to the picture property of the form using VB. For some reason that did not work out for me.
So I had to manually assign a local picture file from the C drive and set the picture property to None. That worked.
But I think VB code should have worked too.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.