çünkü hangi alanların değiştiğini rapor halinde göstermem gerekiyor
@benbendedeilem
Public Function sqls()
Dim i As Integer
Dim sql, strSQL As String
Dim lastTableName, newTableName As String
Dim lastColumnName, newColumnName As String
Dim name1, name2 As String
lastTableName = "itLastPersonel"
newTableName = "itNewPersonel"
strSQL = ""
For i = 0 To CurrentDb.TableDefs(lastTableName).Fields.Count - 1
lastColumnName = CurrentDb.TableDefs(lastTableName).Fields(i).Name
newColumnName = CurrentDb.TableDefs(newTableName).Fields(i).Name
sql = "SELECT" & _
" itLastPersonel.SICNO" & "," & _
" '" & lastColumnName & "' AS AlanAdi" & "," & _
" itLastPersonel.[" & lastColumnName & "]" & "," & _
" itNewPersonel.[" & newColumnName & "]" & _
" FROM itLastPersonel" & _
" INNER JOIN itNewPersonel ON itLastPersonel.SICNO = itNewPersonel.SICNO" & _
" WHERE itLastPersonel.[" & lastColumnName & "]<> itNewPersonel.[" & newColumnName & "]"
strSQL = strSQL & sql
If (i < CurrentDb.TableDefs(lastTableName).Fields.Count - 1) Then
strSQL = strSQL & " UNION ALL "
Else
strSQL = strSQL & ";"
End If
Next i
Me.Liste0.RowSource = strSQL
Me.Liste0.Requery
End Function
Public Function sqls(lastTableName As String, newTableName As String)