This is what I am trying to accomplish:
I have 2 arrays; one holds employee IDs and the other holds the number of depts that they work in (ie. recordcounts)
I have been able to code for the values to be stored in the arrays but don't know how to write these values to a table.
Another twist is this: I want to assign priorities based on the recordcounts (follow example below)
Example: Employee A works 2 depts. Employee B works 3 depts.
Array Employee ={A,B}
Array NoOfDepts={2,3}
Based on this, I want to write the following to a table.
Employee Priority
A 1
B 2
Can someone help me with the latter. I am including the code that shows how the array values are being created. Thanks
rsSpecificDeptTable.MoveLast
rsSpecificDeptTable.MoveFirst
NoOfEmployees = rsSpecificDeptTable.RecordCount
ReDim strEmployeeID(NoOfEmployees)
ReDim strNoOfDepts(NoOfEmployees)
rsSpecificDeptTable.MoveFirst
i = 0
Do While Not rsSpecificDeptTable.EOF
strRetrieveDeptsForEmployeeSelected = "Select * from tblNormalSchedule where txtEmployeeID=" & Chr(34) & rsSpecificDeptTable & Chr(34)
Set rsRetrieveDeptsForEmployeeSelected = db.OpenRecordset(strRetrieveDeptsForEmployeeSelected)
If rsRetrieveDeptsForEmployeeSelected.RecordCount <> 0 Then
strEmployeeID(i) = rsSpecificDeptTable!txtEmployeeID
strNoOfDepts(i) = rsRetrieveDeptsForEmployeeSelected.RecordCount
End If
i = i + 1
rsSpecificDeptTable.MoveNext
Loop
I have 2 arrays; one holds employee IDs and the other holds the number of depts that they work in (ie. recordcounts)
I have been able to code for the values to be stored in the arrays but don't know how to write these values to a table.
Another twist is this: I want to assign priorities based on the recordcounts (follow example below)
Example: Employee A works 2 depts. Employee B works 3 depts.
Array Employee ={A,B}
Array NoOfDepts={2,3}
Based on this, I want to write the following to a table.
Employee Priority
A 1
B 2
Can someone help me with the latter. I am including the code that shows how the array values are being created. Thanks
rsSpecificDeptTable.MoveLast
rsSpecificDeptTable.MoveFirst
NoOfEmployees = rsSpecificDeptTable.RecordCount
ReDim strEmployeeID(NoOfEmployees)
ReDim strNoOfDepts(NoOfEmployees)
rsSpecificDeptTable.MoveFirst
i = 0
Do While Not rsSpecificDeptTable.EOF
strRetrieveDeptsForEmployeeSelected = "Select * from tblNormalSchedule where txtEmployeeID=" & Chr(34) & rsSpecificDeptTable & Chr(34)
Set rsRetrieveDeptsForEmployeeSelected = db.OpenRecordset(strRetrieveDeptsForEmployeeSelected)
If rsRetrieveDeptsForEmployeeSelected.RecordCount <> 0 Then
strEmployeeID(i) = rsSpecificDeptTable!txtEmployeeID
strNoOfDepts(i) = rsRetrieveDeptsForEmployeeSelected.RecordCount
End If
i = i + 1
rsSpecificDeptTable.MoveNext
Loop