Hi,
Does anybody know how I can delete the selected row in a MSFlexGrid and how I can insert a new record?
Printable View
Hi,
Does anybody know how I can delete the selected row in a MSFlexGrid and how I can insert a new record?
Do it through the data control that is linked to the grid....
Code:Private Sub Command1_Click()
'Deletes the current record
Data1.Recordset.Delete
Data1.Refresh
End Sub
Private Sub Command2_Click()
'Adds a new record
With Data1.Recordset
.AddNew
.Fields("SomeFieldName").Value = "Whatever"
.Fields("AnotherFieldName").Value = "Whatever Again"
.Update
End With
Data1.Refresh
End Sub
Thanks, it is a good idea, but it gives the following error:
Can't update. Database or object is read-only.
I've checked the Read-only property in the data control and it is set to false. So, I don't know why I can't update it.