Avatar of sglee
sglee

asked on 

How to remove image from ACCESS FORM

User generated imageHi,

 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
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

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.
Avatar of sglee
sglee

ASKER

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.
Remove it ... from the Form Property sheet?
Using the code I supplied. Ignore my comment about OLE ....
Avatar of sglee
sglee

ASKER

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.
User generated imageUser generated imageUser generated image
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
Avatar of sglee
sglee

ASKER

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?
OK ... sorry ... I see it's only for the Form ...
Let me modify the code if I can ...
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of sglee
sglee

ASKER

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.
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
Avatar of sglee
sglee

ASKER

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

Is there a way to remove this by editing form properties manually?
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.
Avatar of sglee
sglee

ASKER

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.
Avatar of sglee
sglee

ASKER

I keep thinking it is a matter of removing those graphical stuff from the right properties.
"'I would love to, but I can't due to confidentiality..."
Just this Form in an empty db ...
SOLUTION
Avatar of sglee
sglee

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
OK ... so, problem solved ?
My code set it to None.
Avatar of sglee
sglee

ASKER

Yes. The problem solved. Thank you.
I suspect the time delay with MX's code was do the the path being invalid.

Glad you got it sorted out.
Avatar of sglee
sglee

ASKER

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.
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo