the idea is to delete a data from a DataGrid, and then when a ccommand button is clicked, the MSFlexgrid will show and update its data.
NOTE: DataGrid and MSFlexgrid have the same contents or database.
db = Adodc1 Name (for DataGrid)
db1 = DAO Name (for MSFlexgrid)
THIS IS MY CODE FOR DELETING A DATA FROM DATAGRID:
Private Sub Command1_Click() db1.Refresh db.Recordset.Delete db.Recordset.Update
THIS IS MY CODE FOR UPDATING MY MSFLEXGRID
Private Sub Command20_Click() Dim x As Integer Dim y As Integer Dim z As Integer MSFlexGrid1.Visible = True DataGrid1.Visible = False db1.Refresh X = 1 Y = 1 Do Until X = db1.Recordset.RecordCount + 1 MSFlexGrid1.Row = X If Y = 6 Then Y = 1 Else Do Until Y = 6 MSFlexGrid1.Col = Y If Not MSFlexGrid1.object > 0 Then Do Until z = 6 MSFlexGrid1.Col = z MSFlexGrid1.CellBackColor = vbWhite z = z + 1 Loop z = 1 Else MSFlexGrid1.CellBackColor = vbYellow End If Y = Y + 1 Loop Y = 1 End If X = X + 1 Loop X = 1 End Sub
I use DataGrid to delete data because i can easily delete a data by selecting and clicking a command button, i use MSFlexgrid to show my database because i can change the cellbackcolor to highlight some rows.
I can update my database MSFlexgrid, BUT!! only if i click the command button for MSFlexgrid many times, i think it is because on "db1.refresh" code, but my question is, why it doesn't upgrade the MSFlexgrid in just one click.
If someone can show me a code for deleting a data from a MSFlexgrid by selecting a row, I can disregard the usage of DataGrid.
I hope you can understand my problem, although it's too long.. HEHEHE!!!