FROM [R&D-CURRENTEMPLOYEES] INNER JOIN EmployeeSchedules ON [R&D-CURRENTEMPLOYEES].[Person Id] = EmployeeSchedules.[Person Id]
GROUP BY [R&D-CURRENTEMPLOYEES].[Dept Id], [R&D-CURRENTEMPLOYEES].[Last Nm], [R&D-CURRENTEMPLOYEES].[First Nm], [R&D-CURRENTEMPLOYEES].[Dept Ld], [R&D-CURRENTEMPLOYEES].[Empl Stat Cd], [R&D-CURRENTEMPLOYEES].[Person Id], [R&D-CURRENTEMPLOYEES].[Empl Fte Pct], [R&D-CURRENTEMPLOYEES].[Flsa Stat Cd], [R&D-CURRENTEMPLOYEES].[Flsa Stat Ld], EmployeeSchedules.M, EmployeeSchedules.T, EmployeeSchedules.W, EmployeeSchedules.TH, EmployeeSchedules.F, EmployeeSchedules.SAT, EmployeeSchedules.SUN, EmployeeSchedules.TRAVELREDDAY, EmployeeSchedules.MonFrom, EmployeeSchedules.MonTo, EmployeeSchedules.TuesFrom, EmployeeSchedules.TuesTo, EmployeeSchedules.WedFrom, EmployeeSchedules.WedTo, EmployeeSchedules.ThursFrom, EmployeeSchedules.ThursTo, EmployeeSchedules.FriFrom, EmployeeSchedules.FriTo, EmployeeSchedules.SatFrom, EmployeeSchedules.SatTo, EmployeeSchedules.SunFrom, EmployeeSchedules.SunTo, EmployeeSchedules.vacflag, EmployeeSchedules.Scheduletype, EmployeeSchedules.comments, EmployeeSchedules.compflag
ORDER BY [R&D-CURRENTEMPLOYEES].[Last Nm], [R&D-CURRENTEMPLOYEES].[First Nm];
WHERE (((SCHEDULEDATA.[Empl Fte Pct])<0.5));
Public Function CheckDuplicates()
Dim RS As DAO.Recordset
Dim strSql As String
Dim db As DAO.Database
Dim MsgBoxFlag As Boolean
MsgBoxFlag = False
Set db = CurrentDb
strSql = "SELECT First(tblSupervisorList.[Person Id]) AS [Person Id Field], Count(tblSupervisorList.[Person Id]) AS NumberOfDups From tblSupervisorList GROUP BY tblSupervisorList.[Person Id] HAVING (((Count(tblSupervisorList.[Person Id]))>1))"
Set RS = CurrentDb.OpenRecordset(strSql)
If RS.RecordCount > 0 Then
MsgBoxFlag = True
DoCmd.OpenQuery "qryFindDupliatesFortblSupervisorList", acViewNormal, acEdit
End If
strSql = "SELECT First(EmployeeSchedules.[Person Id]) AS [Person Id Field], Count(EmployeeSchedules.[Person Id]) AS NumberOfDups From EmployeeSchedules GROUP BY EmployeeSchedules.[Person Id] HAVING (((Count(EmployeeSchedules.[Person Id]))>1))"
Set RS = CurrentDb.OpenRecordset(strSql)
If RS.RecordCount > 0 Then
MsgBoxFlag = True
DoCmd.OpenQuery "qryFindDuplicatesForEmployeeSchedules", acViewNormal, acEdit
End If
strSql = "SELECT SCHEDULEDATA.[Person Id], SCHEDULEDATA.[Last Nm], SCHEDULEDATA.[First Nm] From SCHEDULEDATA WHERE (((SCHEDULEDATA.[Person Id]) In (SELECT [Person Id] FROM [SCHEDULEDATA] As Tmp GROUP BY [Person Id] HAVING Count(*)>1 ))) ORDER BY SCHEDULEDATA.[Person Id]"
Set RS = CurrentDb.OpenRecordset(strSql)
If RS.RecordCount > 0 Then
MsgBoxFlag = True
DoCmd.OpenQuery "qryFindDuplicatesForSCHEDULEDATA", acViewNormal, acEdit
End If
If MsgBoxFlag = True Then
MsgBox "Duplicate Records Found!", vbExclamation, "Warning"
End If
'SCHEDULEDATA 'W:\DATA MANAGEMENT SERVICES\Database Mappings and Documents\Absence Database\Schedule Data in Absence database.docx
End Function
Jim-
Posted by: Jim Wagner <luvmymelody@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (5) |
Tidak ada komentar:
Posting Komentar