I have an Edit Only form (AllowAdditions property = no) with a button to switch it to data entry (See code sample 1). It also makes a button (cmdEsc) visible which returns the form to Edit only (see Code sample 2). cmdEsc has the 'Cancel' property set to true (allowing the user to hit escape to switch from Data Entry to Edit Only). The form is operating as a subform of the master control panel.
When 'cmdEsc' is clicked, the code works perfectly, but when escape is pressed, the form blanks, as if I'd only switched the DataEntry property off.
If I attempt to step through the code, it works perfectly, if I put a debug.print at the end of code sample 2, then that proves that both AllowAdditions and DataEntry are set to 'False'.
I can work around by either reloading the form after resetting the properties, or by putting a 'DoEvents' in after the 'Me.AllowAddition = False' line. But I can't quite figure out why this is happening - any thoughts?
Code Sample 1
Code Sample 2
Fitz
Did you know, there are 10 types of people in this world:
* Those who understand binary
and
* Those who Don't!!
When 'cmdEsc' is clicked, the code works perfectly, but when escape is pressed, the form blanks, as if I'd only switched the DataEntry property off.
If I attempt to step through the code, it works perfectly, if I put a debug.print at the end of code sample 2, then that proves that both AllowAdditions and DataEntry are set to 'False'.
I can work around by either reloading the form after resetting the properties, or by putting a 'DoEvents' in after the 'Me.AllowAddition = False' line. But I can't quite figure out why this is happening - any thoughts?
Code Sample 1
Code:
Me.AllowAdditions = True
Me.DataEntry = True
Me.cmdEsc.Visible = True
Code:
Me.AllowAdditions = False
Me.DataEntry = False
Me.cmdEsc.Visible = False
Fitz
Did you know, there are 10 types of people in this world:
* Those who understand binary
and
* Those who Don't!!