Sir when i click on grid i got error memeber or data memebr not found and cursor goes on grd_leavecell() event
Kindly help me i also send production_tabletest.mdb .
Private Sub Grd_LeaveCell()
Dim strOldValue As String
On Error GoTo Grd_LeaveCell_Error
If Grd.Col < GRID_COL_OFFSET Then GoTo Grd_LeaveCell_Done
If FlexGridEditor.Visible Then
strOldValue = Grd
Grd = FlexGridEditor.Value
FlexGridEditor.Visible = False
If Grd.Col = cItemCode Then
Call SetProductValues
End If
If Grd.Col >= GRID_COL_OFFSET Then
If Grd.Col < MAX_GRD_COLS - 1 Then
Grd.Col = Grd.Col + 1
ElseIf Grd.Col = MAX_GRD_COLS - 1 Then
If Val(Grd.TextMatrix(Grd.Row, cQty)) = 0 Then
If Trim$(Grd.TextMatrix(Grd.Row, cItemCode)) = "" Or Val(Grd.TextMatrix(Grd.Row, cQty)) = 0 Then
'do nothing
Else
If Grd.Row = Grd.Rows - 1 Then
Grd.AddItem ""
Grd.TextMatrix(Grd.Rows - 1, cSlno) = Grd.Rows - 1
End If
If Grd.Row < Grd.Rows - 1 Then
Grd.Row = Grd.Row + 1
End If
End If
ElseIf Val(Grd.TextMatrix(Grd.Row, cQty)) = 0 Or Trim$(Grd.TextMatrix(Grd.Row, cItemCode)) = "" Then
'Do Not Increment Row
Else
If Grd.Row = Grd.Rows - 1 Then
Grd.AddItem ""
Grd.TextMatrix(Grd.Rows - 1, cSlno) = Grd.Rows - 1
End If
If Grd.Row < Grd.Rows - 1 Then
Grd.Row = Grd.Row + 1
End If
End If
Grd.Col = GRID_COL_OFFSET
If Grd.ColIsVisible(Grd.Col) = False Then Grd.LeftCol = Grd.Col
End If
End If
End If
Grd_LeaveCell_Done:
Exit Sub
Grd_LeaveCell_Error:
Call Process_Error(MODULE_NAME, "grd_LeaveCell")
Resume Grd_LeaveCell_Done
End Sub
Private Sub SetProductValues()
Dim rs As New ADODB.Recordset
On Error GoTo SetProductValues_Error
rs.Open " SELECT ITEM_CODE, PRODUCTNAME, UNIT FROM PARTDETAIL WHERE ITEM_CODE = '" & Grd.TextMatrix(Grd.Row, cItemCode) & "' ", con, adOpenKeyset, adLockReadOnly
If rs.BOF = False Then
Grd.TextMatrix(Grd.Row, cItemName) = rs!ProductName
Grd.TextMatrix(Grd.Row, cUnit) = rs!UNIT
End If
SetProductValues_Done:
If rs.State Then rs.Close
Set rs = Nothing
Exit Sub
SetProductValues_Error:
Call Process_Error(MODULE_NAME, "SetProductValues")
Resume SetProductValues_Done
End Sub
Private Sub FlexGridEditor_KeyDown(KeyCode As Integer, Shift As Integer)
Dim OldValue As Variant
On Error GoTo FlexGridEditor_KeyDown_Error
Select Case KeyCode
Case vbKeyEscape:
FlexGridEditor.Visible = False
Grd.SetFocus
Case vbKeyReturn:
Grd.SetFocus
End Select
FlexGridEditor_KeyDown_Done:
Exit Sub
FlexGridEditor_KeyDown_Error:
Call Process_Error(MODULE_NAME, "FlexGridEditor_KeyDown")
Resume FlexGridEditor_KeyDown_Done
End Sub