|
-
Apr 25th, 2002, 11:51 AM
#1
Thread Starter
Lively Member
Bound Datagrid Nightmare!!!!
The problem I'm having is not complicated at all. I'll be damned if I can fix it though!
I have a datagrid that is populated using a command in the Data Environment.
The datagrid is on my form and allows users to change the fields of a record as they see fit.
I have it set up so that if someone goes into the datagrid and changes a persons gender from M to F it will update the recordset as long as they haven't entered an invalid gender.
If the user has entered an invalid gender, a messagebox pops up telling them they've made an error.
The trouble is that the datagrid updates the record even if an invalid gender was entered!!!!
How to I tell it not to update the record and go back to what was originally there?
I already tried the BEFOREUPDATE event and afterColEdit.
This shouldn't be this hard
I also tried Cancel Update and using transactions to rollback changes. Nothing works!
-
Apr 25th, 2002, 12:51 PM
#2
New Member
The problem is that when you show a message box the focus is lost of the grid and the recordset is updated (because the focus is lost). When you validate the data before showing the error message to the user set the cell value to the what is currently in the recordset for that field and then show your message, it will update because of the lost focus event but with the old value therefore valid value which is what you want. Hope this helps! Make sure that you set CausesValidation to true!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|