Text Box Data Validation

D

Don

Having a bit of a problem with what should probably be a simple task.
Outlined, what needs to be done is as follows:


Text Box is initially locked to prevent accidental data changes

User double clicks
In double click event, text box is unlocked allowing data to be
edited.

In the BeforeUpdate event user is presented with a message box so they can
confirm they want to change the data

If the user selects "Yes", data is changed, focus is changed to next control
and text box is locked.

If the user selects "No", new data is discarded, focus is set to next
control, and text box is locked.



The problem I run into in the "Yes" path is a complaint that the text box
cannot be locked because it is in focus (even after trying to change the
focus).


Down the "No" path, I try to do a .UnDo and Cancel in the BeforeUpdate
event. The issue is when changing focus, there is an error that there is a
pending change to the data.

Is my strategy out of whack? Is there a simpler way of approaching this?

Any suggestions will be greatly appreciated!

Thanks!

Don
 
S

Stefan Hoffmann

hi Don,
Text Box is initially locked to prevent accidental data changes
User double clicks
In double click event, text box is unlocked allowing data to be
edited.
I'd prefer an edit button to click on, it is easier to recognize.
In the BeforeUpdate event user is presented with a message box so they can
confirm they want to change the data
The Form_BeforeUpdate or the event of your TextBox?
The problem I run into in the "Yes" path is a complaint that the text box
cannot be locked because it is in focus (even after trying to change the
focus).
Hm, any error message?
Down the "No" path, I try to do a .UnDo and Cancel in the BeforeUpdate
event. The issue is when changing focus, there is an error that there is a
pending change to the data.
Do you use Me.Undo or TextBox.Undo?
Is my strategy out of whack? Is there a simpler way of approaching this?
Your approach sounds normal.


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top