Hi,
I wrote this function to do what you are talking about... you will need
to clean it up a bit
Code:
--------------------
Sub check2()
On Error GoTo errcheck2
Dim Apples As Database, Bananas As Database, Tee As TableDef, Ess As TableDef
Dim foundIt As Boolean, Eff As Field, Gee As Field
Dim Pee As Property, Kyu As Property
Set Apples = OpenDatabase("C:\currentcopies\testcalchistory.mdb")
Set Bananas = OpenDatabase("C:\currentcopies\calchistory.mdb")
For Each Tee In Apples.TableDefs
foundIt = False
For Each Ess In Bananas.TableDefs
If Ess.Name = Tee.Name Then
foundIt = True
Exit For
End If
Next
If foundIt Then
For Each Eff In Ess.Fields
foundIt = False
For Each Gee In Tee.Fields
If Eff.Name = Gee.Name Then
foundIt = True
Exit For
End If
Next
If foundIt Then
If Eff.Size <> Gee.Size Then Debug.Print "Field Changed: " & Tee.Name & "." & Eff.Name & ".Size = " & Eff.Size & " (was = " & Gee.Size & ")"
If Eff.Type <> Gee.Type Then Debug.Print "Field Changed: " & Tee.Name & "." & Eff.Name & ".Type= " & Eff.Type & " (was = " & Gee.Type & ")"
If Eff.AllowZeroLength <> Gee.AllowZeroLength Then Debug.Print "Field Changed: " & Tee.Name & "." & Eff.Name & ".AllowZeroLength = " & Eff.AllowZeroLength & " (was = " & Gee.AllowZeroLength & ")"
If Eff.DefaultValue <> Gee.DefaultValue Then Debug.Print "Field Changed: " & Tee.Name & "." & Eff.Name & ".DefaultValue = " & Eff.DefaultValue & " (was = " & Gee.DefaultValue & ")"
Else
Debug.Print "Lost Field " & Tee.Name & "." & Eff.Name
End If
Next
Else
Debug.Print "Lost Table " & Tee.Name
End If
Next
For Each Tee In Bananas.TableDefs
foundIt = False
For Each Ess In Apples.TableDefs
If Ess.Name = Tee.Name Then
foundIt = True
Exit For
End If
Next
If foundIt Then
For Each Eff In Ess.Fields
foundIt = False
For Each Gee In Tee.Fields
If Eff.Name = Gee.Name Then
foundIt = True
Exit For
End If
Next
If foundIt Then
If Eff.Size <> Gee.Size Then Debug.Print "Field Changed: " & Tee.Name & "." & Eff.Name & ".Size = " & Eff.Size & " (was = " & Gee.Size & ")"
If Eff.Type <> Gee.Type Then Debug.Print "Field Changed: " & Tee.Name & "." & Eff.Name & ".Type= " & Eff.Type & " (was = " & Gee.Type & ")"
If Eff.AllowZeroLength <> Gee.AllowZeroLength Then Debug.Print "Field Changed: " & Tee.Name & "." & Eff.Name & ".AllowZeroLength = " & Eff.AllowZeroLength & " (was = " & Gee.AllowZeroLength & ")"
If Eff.DefaultValue <> Gee.DefaultValue Then Debug.Print "Field Changed: " & Tee.Name & "." & Eff.Name & ".DefaultValue = " & Eff.DefaultValue & " (was = " & Gee.DefaultValue & ")"
Else
Debug.Print "Lost Field " & Tee.Name & "." & Eff.Name
End If
Next
Else
Debug.Print "Lost Table " & Tee.Name
End If
Next
Set Ess = Nothing
Set Tee = Nothing
Set Apples = Nothing
Set Bananas = Nothing
Set Eff = Nothing
Set Gee = Nothing
Exit Sub
errcheck2:
LogErr "Module1", err.Number, err.Description, "check2"
End Sub
--------------------
hope this helps,
aaron