I have 2 tables Sheet1 and Sheet2. They both have identical data and contain Employee Info like name, address, ID, Division,etc. HR wants to update the info in Sheet2 using a form "Sheet2 Form" where they find the employee using ID and then update their info.
Now I have created a button that updates the Sheet1 employee info with the current record that we are viewing in Sheet2 Form. So I created a button in the form with the name "Update Record in Sheet1". On click event I wrote the following vba code
Expand|Select|Wrap|Line Numbers
- Private Sub Command198_Click()
- Dim strSQL As String
- strSQL = "UPDATE Sheet1 SET Sheet1.DIVISION = " & Sheet2_subform.DIVISION & " WHERE Sheet1.Empl_ID = " & Empl_ID & ""
- DoCmd.RunSQL strSQL
- End Sub
Thanks