Jeanette Cunningham said:
Trying to work out the real problem.
I appreciate that. I wish you could look over my shoulder, that would be a
lot easier than me having to reveal more and more of this rather tortured
process.
If a user makes a change to an authorized order, why do you need to show the
authorize button again if it has already been authorized?
If the order has been authorized prior to the current editing session, then
the "Authorize" button never has to be shown again. There is no way to
"unauthorize" a previously-authorized order. That part is fine: undoing
anything else doesn't change the state of the two buttons.
If the user press Esc, I assume that the authorized by field becomes null.
Only if the authorization is being done in the current session.
Let's see if I can enumerate the possibilities:
1. The order DOES NOT require authorization. The "Authorize" button is never
shown, the "Order" button is always shown. This is handled easily in the
Current event for the form, and none of the rest of this applies.
2. The order DOES require authorization. Authorization might occur when the
order is entered, or at any time thereafter. The form's Current event sets
the states of the two buttons, based upon whether or not the order has
already been authorized. There is no way to "unauthorize" an order, so this
is very straightforward as well.
3. When the user clicks on the "Authorize" button, the On Click event
handles the challenge and response. If the user's response is satisfactory,
the "authorized" flag is set in the record, the "Authorize" button
disappears, and the "Order" button appears. If the user's response is
rejected, the "authorized" flag is left null. Note that at this point the
record has not been updated, so the "authorized" flag is dirty.
4. If the user now saves the record, everything is fine: the "authorized"
flag is saved, the "Authorized" button is gone, and the "Order" button is
there forever.
5. If the user UNDOES the editing of the record, and has NOT authorized the
order in the current editing session, everything is fine.
6. If the user HAS authorized the order in the current editing session
(which might have consisted solely of the authorization), and then UNDOES the
editing, I want the "Authorize" button button to re-appear and the "Order"
button to disappear. In other words, I want the two buttons to go back to the
state set by the form's Current event.
The only place I can think of to do this is in the form's Undo event. That's
where I've hit a dead end.
A couple of ideas.
Idea 1: Trap the use of the Escape key and when it is used, display the
authorize button again for appropriate suppliers.
I'll have to think about that. The escape key, when hit once, only undoes
the current field. I'd have to look for it to be hit twice, with no
intervening activity. That sounds like a challenge.
Idea2: If the order has been authorized, code around the Esc key being
pressed so that if the Authorized by field has a value it can't be undone.
The authorize button won't need to be shown again.
That, unfortunately, doesn't do what I want. See 6 above.
Thanks for your help.