XXX Chats

Cuce adult cam sohbet

Validating datagrid values

Hi I need to be able to validate the data entered into the columns of a row in a datagrid in Visual Basic 6 as the user tries to move away from the row they have just entered data into.The primary use of this to validate a new inserted row at the end of the datagrid, but might also need to be applied to validating changes to an existing row. Although this does show a message telling the user of invalid data it still allows the cursor to move to another row and will allow the data in the invalid row to be sent to the database.

Cancel = True End If End Sub This isn't quite working because of what I am trying to do I think.

The event only seems to be called on the column you make a change to and you have to make a change to the column in order for the event to be called.

What I'm trying to do is ensure columns have not been left blank as well as validating a value if one has been entered.

Using the above works great for the entry into a column, but if the user has entered something into columns 1 & 4 and not 2 & 3 because they've used the mouse to change columns I need to tell the user columns 2 & 3 are required entry.

On writing this I'm thinking I can resolve this by getting the current column and carry out validation on all previous columns before allowing a value into the current column. The problem I will have is when the user changes rows.

How do I check the previous row values when the user moves to another row without completing the required fields on the previous row?I have been able to resolve the outstanding part of this question myself.I did make use of the Before Col Udpate event when a value was entered/changed in a column so thank you Tim Cottee for this suggestion.I have asked for 150 of the original 250 points to be awarded to you.To resolve the problem of validating blank entries I had to do a complete recordset scan to check for invalid rows before doing the recordset update method.If an invalid row was detected the row was highlighted and the user was returned to the grid so they could enter correct values.The user was not allowed to post the data until the recordset validate scan returned OK.Cheers Mark Tim Coffee, A request has been made in Community Support to close this question: there are no objections, after 72 hrs, a moderator will finalize this question by: - Saving this Q as a PAQ and refunding the points Please leave any recommendations here.Best regards, Yensid Mod Community Support Moderator @Experts Exchange I am happy to close the Q, apologies to mvsmith07 that I may not have responded all the time as notifications seem a little out of sync at the moment.Anyway a reduction to 150 points seems like a fair solution so Yensid Mod go ahead and close this one out. Hi Guys, I need Some help in validating a particular coloumn in datagrid for duplicate values before inserting into database. Please help with some example code.appreciate our help.

Comments Validating datagrid values