Hi, I'm trying to make a VBA program to update and Save record, unfortunately, the following program only effect on the 1st record in the table.
This is the button function that I placed in a form with detail, can anyone can point out where is the problem?
Private Sub btItemSave_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim txtItemNo As String
***Set db = CurrentDb
***Set rst = db.OpenRecordset("ItemMaster", dbOpenDynaset)
***rst.Edit
***rst!UpdatedDate = Now()
***rst!Time = Now()
***rst!UpdatedBy = txtUserID 'Varient UserID
rst.Update
rst.Close
db.Close
On Error GoTo Err_btItemSave_Click
***DoCmd.RunCommand acCmdSaveRecord
Exit_btItemSave_Click:
Exit Sub
Err_btItemSave_Click:
***MsgBox Err.Description
***Resume Exit_btItemSave_Click
***
End Sub
This is the button function that I placed in a form with detail, can anyone can point out where is the problem?
Private Sub btItemSave_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim txtItemNo As String
***Set db = CurrentDb
***Set rst = db.OpenRecordset("ItemMaster", dbOpenDynaset)
***rst.Edit
***rst!UpdatedDate = Now()
***rst!Time = Now()
***rst!UpdatedBy = txtUserID 'Varient UserID
rst.Update
rst.Close
db.Close
On Error GoTo Err_btItemSave_Click
***DoCmd.RunCommand acCmdSaveRecord
Exit_btItemSave_Click:
Exit Sub
Err_btItemSave_Click:
***MsgBox Err.Description
***Resume Exit_btItemSave_Click
***
End Sub