Link to home
Start Free TrialLog in
Avatar of raulopez
raulopez

asked on

DBGrid AfterColEdit

Hello Experts!

I'm working (VB5) with a bounded DBGrid and need to validate the information entered in Col# 7.

I've writted this code:

Private Sub DataGrid_AfterColEdit(ByVal ColIndex As Integer)
    If DataGrid.Col = 7 Then
    'Verify if CodeX is valid
        Set Db = Workspaces(0).OpenDatabase(App.Path & "\Data2.mdb")
        Set Rs = Db.OpenRecordset("Values")
        With Rs
            .Index = "CodeX"
            .Seek "=", DataGrid.Columns(7).Value
            If .NoMatch Then MsgBox "Invalid CodeX", 16, "Data2 Values"
        End With
    End If
End Sub

It works ok, but I want to return the focus to column 7 in order to force the entry of a valid CodeX.

What must I add?

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of richtsteig
richtsteig

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial