Results 1 to 3 of 3

Thread: dbgrid data entry validation

  1. #1

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188

    Angry dbgrid data entry validation

    Hey all,

    How can i make sure that what the user enters is correct!

    For example:

    I have in the grid on it's button click event it shows a combo box. I want to make sure that if they manually enter data into that column that it's correct or stop them from manually entering data without selecting it from the combo box.

    if that doesnt make sense please tell me?
    thanks

  2. #2
    Fanatic Member rudvs2's Avatar
    Join Date
    Mar 2001
    Location
    NZ
    Posts
    935
    Beacon mate

    Im not sure if I have understood your question correctly

    But If you were wanting to validate the text before it is written to the database
    Use the Before Update and After Update events in the datagrid

    Then you can have a routine in ther which checks the string for a set of your specified parameters

    Let me know if im way off

  3. #3

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    yep figured it out did it this way:

    Private Sub dbgrid_ColEdit(ByVal ColIndex As Integer)
    If ColIndex = 0 Then
    MsgBox "Please Select Item From List", vbExclamation, "InValid Entry"
    ElseIf ColIndex = 2 Then
    MsgBox "Please Select Item From List", vbExclamation, "InValid Entry"
    ElseIf ColIndex = 3 Then
    MsgBox "Please Select Item From List", vbExclamation, "InValid Entry"
    End If
    End Sub

    So they cant type in values which is heaps better!
    thanks anyways rudvs2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width