Sub exaCurrentDb2()
Dim dbOne, dbTwo As Database
Dim fldNew As Field
Dim str As String
Set dbOne = CurrentDb
Set dbTwo = CurrentDb
For Each fldNew In dbOne.TableDefs!BOOKS.Fields
Debug.Print fldNew.Name
Next
Set fldNew = dbOne.TableDefs!BOOKS.CreateField("NewField1", dbInteger)
dbOne.TableDefs!BOOKS.Fields.Append fldNew
Set fldNew = dbTwo.TableDefs!BOOKS.CreateField("NewField2", dbInteger)
dbTwo.TableDefs!BOOKS.Fields.Append fldNew
dbOne.TableDefs!BOOKS.Fields.Refresh
For Each fldNew In dbOne.TableDefs!BOOKS.Fields
Debug.Print fldNew.Name
Next
For Each fldNew In dbTwo.TableDefs!BOOKS.Fields
Debug.Print fldNew.Name
Next
dbOne.Close
dbTwo.Close
End Sub
|