I have an employee, project and EmpToProj table.
Many to many relationships.
If a project is removed from the employee.
The admin can do that.
It is removed in the emptoproj table.
Now my problems is:
This is all for the timesheet.
Everytime an employee opens the timesheet to enter his hours.
The projects which he had already filled for the previous weeks displays. Without hours.
So that the employee need not manually choose the projects everytime.
If the project is removed from the employee.
It should not show in the timesheet.
Rest of the projects should show.
How shall I proceed?
I need a query to display only the current projects under the employee in the timesheet.
Query which I used to remove the projects from the employee is:
Private Sub cmdRemove_Click()
On Error GoTo cmdRemove_Click_Error
Dim sSQL As String
Dim rSQL As String
Dim nMid As Long 'Member
Dim nWid As Long 'Event
Dim varRow As Variant
Dim ctlChosen As Control
If Len(lstEmployee.Column(0) & vbNullString) = 0 Then
MsgBox "There is no Member selected.", vbOKOnly + vbInformation, " I N P U T N E E D E D "
Exit Sub
End If
nMid = lstEmployee.Column(1)
'Check that at least one item has been selected
If lstAssigned.ItemsSelected.Count = 0 Then
MsgBox "Please select an event to remove from this Members's list.", vbOKOnly + vbInformation, _
" I N P U T N E E D E D "
lstAssigned.SetFocus
Exit Sub
End If
Set ctlChosen = lstAssigned
For Each varRow In ctlChosen.ItemsSelected
nWid = ctlChosen.Column(0, varRow)
sSQL = "DELETE * FROM EmpToProj WHERE EmployeeID = " & nMid & " AND ProjectID = " & nWid & ";"
CurrentDb.Execute sSQL, dbFailOnError
lstAvailable.Requery
lstAssigned.Requery
Next varRow
cmdRemove_Click_EXIT:
Set ctlChosen = Nothing
Exit Sub
cmdRemove_Click_Error:
Select Case Err
Case Else
Call fcnLogError(Err.Number, Err.Description)
End Select
Resume cmdRemove_Click_EXIT
End Sub