Delete/replace controls and code without corrupting the front-end

PhoenixofMT

Part-time Access Guru
Local time
Yesterday, 17:44
Joined
Jul 23, 2008
Messages
35
I've just wasted about 3 hours trying to reconstruct a form because (i think) deleting a control and then replacing it with a new one with the same name causes compile errors.

<background>
I started this project a couple of years ago but my skills and creative vision did not fit the schedule and the "Yeah, it works... mostly" version has been in place ever since, with only sporadic attempts made to get some of the original plan ready in the background.
I finally have a mandate to go in and fix some things up the way I originally intended while adding some new features.
</background>

Part of this involves a form that got started a while back before I converted everything to use Office 2010. Now that I've got the fancy themes to play with I'd like to use them, but I still have a couple of ugly square, gray buttons hanging around.

Rather than fiddle around with the myriad color and style properties , I decided--like a fool--to simply use the button tool to replace them. I cut and pasted the code to a text file and deleted the control and then the subroutine. When I had the new controls in place I cut and pasted the old code back into the "new" event procedures (just the code between the "Private Sub..." and "End Sub" of course. I learned long ago about telling Access what order to put subroutines in.) But after getting the new buttons in place I was plagued by "Method or data member not found" errors. The last time this happened I was trying to edit Access 2000 projects on networked drives.

So now I've reverted to the last-known-good copy, ready to start all over, but I don't want to make the same mistakes. Could this happen again if I rename the old form and then recreate it from scratch using the old name?

Any advice is greatly appreciated,

Phoenix

P.s. A secondary but somewhat related issue with buttons I've noticed is that when built-in Access icons are used on buttons, the focus frame (little dots that outline the control) appear in the top left of whatever section the control is in (e.g. Detail, Footer, etc.) and will alternate appearing on the actual control if you click it multiple times. Has anyone else seen/fixed this?
Also, I seem to be stuck with the old-school icons. I know I was in some kind of window (command button wizard?) that had new style button icons in it, but I don't know how to get them back.
 
If the changes your making are to the buttons only, not removing any referenced fields on the form, then copying the old code wont cause corruption problems.

Check your references to make sure nothings missing (VBA window - Tools - References) Try and match as close as you can to your old references.

Also If you've installed SP1 for 2010 then remove it. Not only dose it not work but causes corruption.

Hope something here helps.

Regards
SmallTime

PS sorry no idea on the secondary issue.
 

Users who are viewing this thread

Back
Top Bottom