module code stops working

antonyx

Arsenal Supporter
Local time
Today, 02:59
Joined
Jan 7, 2005
Messages
556
just wondering why randomly certain modules in the form code stop working..

when you accidentally press return.. or do something in the wrong order.. or apply one rule to one control.. and then another control rule stops working..

so you have to delete the code.. right click on the control's event.. and re-insert the code into the event section.. and then it works..

why?
 
I think we need slightly more of a description of the circumstances and the environment to answer that one.

WHAT KIND of control? When a control interact occurs, what relationship - if any - exists between the controls and their underlying data? At any point does one of the code snippets attempt to modify something about the control itself? Remember that the entry points to class modules are contained in properties of the control in question. So if you modify something that has a name that inadvertanly matches a control's property, you can get zapped really good. Particularly if you have a "with" clause, if I'm not confusing languages too badly.
 
well is there any particular order you should code the form... eg from top to bottom.. or from the start focus to the end focus.??

for example.. is there a way to separate the code..

at the moment.. im either pressing return once or twice in between various control codes...can this sometimes mess things up..

also i will use the same piece of code for a control's change event and the lost focus event..

and my controls are named the same as my fields.. as they do when a default form is created from a table/query..

is this bad practice..

there are just certain things that stop working randomly and i have to do it again.. its annoying.
 
I'm not sure either what you are saying, but...

There are many sources for "Naming Conventions". For example, Microsoft. It isn't mandatory, but makes code alot easier to read and reduces problems later. Never have the control name the same as the source name.

If you are copying code from within one function/sub to another, make sure you change the procedural references to match the function/sub name you are putting it in.

If you can post the form's module code, that'll help figure out what you mean.
 
Last edited:
the concept of order in the access environment is somewhat blurred.

there are some events defined by an order, for instance pressing tab advances from control to control as defined by tabstops and taborders. within a code module the procedure flows from statement to statement.
In this ccase, pressing the enter key may work differently from pressing tab in some circumstances.

But pretty well most of the time, the whole application reacts to EVENTS, which can be anything from a particular control (ie label text box combo box etc) being entered, left, clicked, dble-clicked etc, a mouse moving over a particluar area of the screen, a blank area of a form being clicked, or even to a timer event occurring ie a form is specified to check itself every so often. An error is also an event which can be managed. These can be errors in coding, but can also be things like trying to perform actions on empty datasets.

So I would think that if your code is behaving unexpectedly, its perhaps because your application is reacting to an event of some sort, and its hard to identify exactly what this is without examining your code.
 

Users who are viewing this thread

Back
Top Bottom