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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A Copied form using the original's code behind module!?!?!

Status
Not open for further replies.

adamcbest

MIS
Feb 6, 2006
38
US
Ok. This is strange. i started with large form that i wanted to copy and make few changes to, but otherwise the form is the same. the first form worked fine, but when the copied one runs the form load event, it first pulls the module that is associated with the original. Any idea why a copied form would run the module of the original? I hope this makes sense, it's a very strange problem to me. Is there some issue with the form identity properties that is making it pull the wrong module?
 
Hello:

If you copied a form, and it had code behind it, the code will run when summoned. You must delete the code in the copied form that you do not wish to summon.

Regards
Mark
 
yes.. i have changed the code. say i had frm1 and i copied it and named it frm2 and did the mods to frm2's code behind. when i switch to normal view from design view of frm2 i get run time errors becuase frm2 has differnt controls, then if i hit debug, it brings up frm1's code behind with the line rbeak highlighted in frm1's module. if i comment out every line that gives me an error in frm1's module. then it moves to frm2's module.

it's not that it's using the same code. it's actually using the original module rather than the new module
 
Are there any public functions in frm1 that frm2 might be calling?

Is there any code that is specifically calling frm1, e.g.

Forms("frm1").Something



 
well it first got hung up on a dcount() function i had in frm1's form load event. for the sake of testing i put a "msgbox 'test'" in above that to see if frm2 would call that when i loaded it and it does. so it appears it's calling the whole module. There are a couple global variables that are used in every form (mostly for dynamic color changing depending on user), but i've had no other problems with any other form, and there are no other public functions in the form load procedure of either form
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top