Hello everybody. I need some help. I have my project and im having trouble in msflexgrid. I will describe wat i wont.
Code:Option Explicit Public cnn As ADODB.Connection Public mrs As ADODB.Recordset Public cmd As ADODB.Command Public Sub dbConnection() Set cnn = New ADODB.Connection With cnn .Provider = "Microsoft.jet.oledb.4.0" .ConnectionString = "data source = " & App.Path & "\Data\MPMAIN.mdb" .CursorLocation = adUseClient .Open End With End SubBut with this code i can only update only one record in the table MAIN of my database, that which is the first on the MSFLEXGRID list and I want to update all records that are in MSFLEXGRID list. My table MAIN structure is KEY|NAME|DESCIPTION|CATEGORY|QUANTITY|VALUE1|VALUE2 and my MSFLEXGRID structure is NAME|DESCRIPTION|QUANTITY|VALUECode:Private Sub cmdOK_Click() Dim rrr As Integer Dim ccc As Integer Call dbConnection Set cmd = New ADODB.Command cmd.ActiveConnection = cnn cmd.CommandText = "update MAIN set QUANTITY=QUANTITY- val(" & MSFLEXGRID.TextMatrix(rrr + 1, ccc + 2) & ")where NAME='" & MSFLEXGRID.TextMatrix(rrr + 1, ccc) & "' " cmd.Execute End Sub
I hope to have made my self clear and I hope that you will be able to help me.




Reply With Quote