Dim rstDossier As ADODB.Recordset
Dim rstTemp As ADODB.Recordset
Dim sql As String
Set rstDossier = New ADODB.Recordset
Set rstTemp = New ADODB.Recordset
'Define and Open recordset of tbl_Dossier
sql = "SELECT tbl_Dossier.* FROM tbl_Dossier;"
rstDossier.Open sql, CurrentProject.Connection, _
adOpenStatic, adLockOptimistic
'Define and Open recordset of tbl_TempDossierRecordSource
sql = "SELECT tbl_tempDossierRecordSource.* FROM tbl_tempDossierRecordSource;"
rstTemp.Open sql, CurrentProject.Connection, _
adOpenStatic, adLockOptimistic
'Compare both recordsets and update tbl_Dossier to reflect tempDossierRecordSource
'Delete: remove records from tbl_Dossier that are not in the temp table
'if there are no records left in the temp table
'then delete all records in tbl_Dossier and exit sub
If rstTemp.RecordCount = 0 Then
|