get the previous data and make the chages

R

Ranjith Kurian

My below code update the tables,

sometime if i update the data wrong and i need to correct it, so i would
like to create one more command button, on click of that it should match the
text box txtActivite.value and pull all other informations
(cboDate.Value,cboName.Value,txtStatus.Value,txtAudit.Value,cboAuditName.Value) and save the replace the new change to the table



Private Sub Command10_Click()
Dim db As Database
Dim rs As Recordset
Dim sqlstring As String

Set db = CurrentDb
Set rs = db.OpenRecordset("tbl Master", dbOpenDynaset, dbAppendOnly)
With rs
..AddNew
..Fields("Date").Value = cboDate.Value
..Fields("Name").Value = cboName.Value
..Fields("Activite").Value = txtActivite.Value
..Fields("Status").Value = txtStatus.Value
..Fields("Audit").Value = txtAudit.Value
..Fields("Audit Name").Value = cboAuditName.Value
..Update
End With

Set rs = Nothing
Set db = Nothing

End Sub
 
P

Piet Linden

My below code update the tables,

sometime if i update the data wrong and i need to correct it, so i would
like to create one more command button, on click of that it should match the
text box txtActivite.value and pull all other informations

Is this an unbound form? If not, you should be able to just filter
the form for the single record you need, then save it. You shouldn't
need the recordset mess at all. The only time you even might need
something like this is if you're duplicating an existing record that
you want to modify...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top