Hello friends,
I have a form that contains,
Item name------Combo box.
Msflex grid for Item name,qty.
If I select an item name from combo box,that name will be displayed in the
flexgrid first column Item name.Only I have to enter the qty.
If I enter 3 item names and qty like
Item name Qty
A 1
B 2
C 2
If I want to change the item from B to D,error comes.it shows "Enter qty"
It is not changing.How to clear the entire row details and enter a new item
My code:
VB Code:
Private Sub cbomname_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then If c <> 2 Then If rec.State > 0 Then rec.Close rec.open "select * from Materials where code='" & cbomname.Text & "'", conn Text1.SetFocus Text1.Text = cbomname.Text c = c + 1 MSFlexGrid1.Col = MSFlexGrid1.Col + 1 Mod MSFlexGrid1.cols Else: MsgBox "Error, Enter quantity.", vbExclamation, "Items" End If End If End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) On Error Resume Next If KeyAscii = 13 Then If c = 2 Then r = r + 1 MSFlexGrid1.rows = r MSFlexGrid1.Col = 0 MSFlexGrid1.Row = i MSFlexGrid1.Col = MSFlexGrid1.Col + 1 Mod MSFlexGrid1.cols Text1.SetFocus MSFlexGrid1.TextMatrix(i + 1, Col) = r - 1 c = 1 i = i + 1 MSFlexGrid1.Row = MSFlexGrid1.Row + 1 Mod MSFlexGrid1.rows cbomname.SetFocus End If q = i q = q - 1 end if
