Allow Additions on what event?

Mr.K

Registered User.
Local time
Yesterday, 21:32
Joined
Jan 18, 2006
Messages
104
Set AllowAdditions back to False after NOT entering a new record - but on what event?

I have a continueous subform which has allowadditions set to False. Then I have an "add new record" which changes the allowadditions to True and sends user to the empty new record. Now, let's say the user decides to leave the proccess of entering the new record (before entering anything in any of the text boxes) and clicks somewhere outside the empty record section - how (on what event) can I reset the allowadditions to false at this moment and hide the new empty record section?

AfterInsert event won't do the job because the user did not enter anything. Is there OnLostFocus just for that empty record section? I know OnCurrent would work if the user clicked away onto another record but what if he just clicks somwhere outside the empty record without deselecting that empty record? Is there a way of "locking" the user to the proccess of being only in that empty new record untill let's say he clicks my Undo btn?? (Although I'm not sure if that's a good idea)

I basically want to disallow additions the minute the user decides that he doesn't want to enter a new record after all.
 
Last edited:
You could use the me.new to establish if user is in a new record, me.dirty to see if existing record has been edited. beforeupdate event to trap and cancel unwanted edits, or before insert to trap unwanted edits

Why do you want the hassle of changing the allow additions etc, when the above will serve.

If you really want to do stuff like this, you could just store a boolean variable in the form, and test this in the before insert event to decide whether to permit a new record, or not.
 
Read you query again.

I see what you are trying to do, and perhaps my thoughts arent valid. How does your user cancel his entry? Are you getting partial records written to the DBS?
 
I would probably try to disable everything on the main form and have a cancel and save button, so that they don't have anything else to click on to get out of the subform.
 
gemma-the-husky said:
Read you query again.

I see what you are trying to do, and perhaps my thoughts arent valid. How does your user cancel his entry? Are you getting partial records written to the DBS?

Partial records are accepted. The subform is sitting on a TAB control and it has the following buttons:
Add New - it changes allowadditions to TRUE
Save - disabled when when no records exist and/or after the last one was deleted
Delete - disabled when no records exist and/or after the last one was deleted
Undo - disabled; gets enabled when user clicks Add New

At this point what I wished to acomplish is to keep the proper buttons enabled/disabled during a particular action the user might take. I think I did acomplish it after covering lots of scenarios and enabling/disabling a given btn in OnClick event of another btn. However, I was hoping for a simpler solution (nicer) then the one I implmented since mine gets a little confusing and I hope I covered all the possibilities.

Thanks for help.
 

Users who are viewing this thread

Back
Top Bottom