Databases Reference
In-Depth Information
dbOne.TableDefs!BOOKS.Fields.Refresh
' Get field list now using dbOne
str = str & vbCrLf & "Fields after using dbOne: " & vbCrLf
For Each fldNew In dbOne.TableDefs!Books.Fields
str = str & fldNew.Name & vbCrLf
Next
' Get field list now using dbTwo
str = str & vbCrLf & "Fields after using dbTwo: " & vbCrLf
For Each fldNew In dbTwo.TableDefs!Books.Fields
str = str & fldNew.Name & vbCrLf
Next
MsgBox str
dbOne.Close
dbTwo.Close
End Sub
Running this code produces the window shown in Figure 14-14.
Figure 14-14. Message box from executing exaCurrentDb2
Thus, it appears that changing the Database object pointed to by dbTwo does in fact also
change the Database object pointed to by dbOne . However, if we do not refresh the
Fields collection using the variable dbOne , or if we refresh using the variable dbTwo
instead, we get the message box shown in Figure 14-15. Note that NewField2 is missing
from the second group.
Search WWH ::




Custom Search