Ok, I admit, I use bits of code I only “sorta unnastand”.
I have code (see below) that writes a record in a table, and I understand what it does.
With rst
.AddNew
![Job #] = cboChooseJob
!DeptVal = optDept
!Employee = lstEmployees.ItemData(varItm)
!Hours = HrInput
.Update
End With
What I want is code to change the value of .!Hours.
Dim rst As Recordset
Dim strRegistrationIDs As String
Dim varItm As Variant
If lstEmpAllocated.ItemsSelected.Count > 0 Then
‘ Build a list of the registrations to remove
For Each varItm In lstEmpAllocated.ItemsSelected
strRegistrationIDs = lstEmpAllocated.ItemData(varItm) ‘this value is the record ID for the chosen record. (tblJobAllocate.AllocID)
Next
****** Code to go in here?*******
With rst
.Edit
. !Hours = HrChanged
.Update
End With
End If
strRegistrationIDs tells me the record, how do I point to it correctly in order to change it.