Answer» Dear Sir
I need really urgent help. I have a database table in Access 2002 & I'm using VB6. I can save data and also can display data after searching from the database table on a form in VB6. Now I WANT to edit that particular data which I have fetched from the database table by searching and which is DISPLAYING on the form in VB6. After that, I want to edit that particular data that is displaying. After editing I will save that edited data in the table. At this point currently edited data/record will be superimposed on previous data. And that is what I need to know. Please see my code which I have used for data save & find, in below.
Code: [Select]Dim RST As New ADODB.Recordset
CODE FOR SAVE: Private Sub cmdsave_Click() DBconnect If rst.State = adStateOpen Then rst.Close rst.Open "tblsystemusing", CNT, adOpenDynamic, adLockOptimistic
With rst .AddNew .Fields(0) = cmbfloor.Text .Fields(1) = cmbuser.Text .Fields(2) = cmbusercode.Text .Fields(3) = cmbitemname.Text .Fields(4) = cmbitemrefno.Text .Update MsgBox "Saved" End Sub
CODE FOR FIND: Private Sub cmdfind_Click() DBconnect If rst.State = adStateOpen Then rst.Close rst.Open "tblsystemusing", cnt, adOpenDynamic, adLockOptimistic
While Not rst.EOF
If cmbusername.Text = rst.Fields(1) Then With rst cmbfloor.Text = .Fields(0) cmbuser.Text = .Fields(1) cmbusercode.Text = .Fields(2) cmbitemname.Text = .Fields(3) cmbitemrefno.Text = .Fields(4) End With End If rst.MoveNext Wend End Sub
Please come back at your earliest as I have fallen in difficulties with this.
Regards talorababu
|