Hello there! Thank you for taking a look at my question.
I have a table, refEmployees, with a key of EmployeeID and a date field of ADM001Test.
On the form where a button calls the function to add the date, the EmployeeID is set as a hidden field [Forms]![frmTrainingModule]![cboUserName] which gives the correct EmployeeID.
I need to add today's date to [ADM001Test] for the correct EmployeeID row.
My recordset .AddNew VBA knowledge is lacking because I can't seem to grasp the concept. Here is my flailing attempt at the code - obviously it does not work.
Thank you very much for your help!
Scott
Dim rs As DAO.Recordset
Dim strSQL As Date
Dim IntFieldIndex As Integer
strSQL = [ADM001Test]
IntFieldIndex = [Forms]![frmTrainingModule]![cboUserName]
Set rs = CurrentDb.OpenRecordset(strSQL)
With rs
.AddNew
.Fields("ADM001Test") = Date
.Update
End With
rs.Close
Set rs = Nothing
I have a table, refEmployees, with a key of EmployeeID and a date field of ADM001Test.
On the form where a button calls the function to add the date, the EmployeeID is set as a hidden field [Forms]![frmTrainingModule]![cboUserName] which gives the correct EmployeeID.
I need to add today's date to [ADM001Test] for the correct EmployeeID row.
My recordset .AddNew VBA knowledge is lacking because I can't seem to grasp the concept. Here is my flailing attempt at the code - obviously it does not work.
Thank you very much for your help!
Scott
Dim rs As DAO.Recordset
Dim strSQL As Date
Dim IntFieldIndex As Integer
strSQL = [ADM001Test]
IntFieldIndex = [Forms]![frmTrainingModule]![cboUserName]
Set rs = CurrentDb.OpenRecordset(strSQL)
With rs
.AddNew
.Fields("ADM001Test") = Date
.Update
End With
rs.Close
Set rs = Nothing