Im trying to preform an exisize that will help me understand arrays and there uses. What i want to do is from one database (a)lookup another database (b)and if the tables match import the new table from the second database. The first piece of code loads all the table names in the in an array from db(a). What I now want to do is for each table in db (b) look up the array and if it matches import it from db(a). I not sure how I access the information stored in the array. Can anyone point me in the right direction . Many thanks
My code so far is :
Public Function getTables()
Dim wsp As Workspace
Dim dbs As Database, dbsAnother As Database
Dim tdf As TableDef
Dim iDbCodeTables As Integer
Dim i As Integer
Set dbs = CurrentDb
Set wsp = DBEngine.Workspaces(0)
Set dbsAnother = wsp.OpenDatabase("S:\cadproj\DAILYREP\DATABASE\Liquidity\LiquidityMaster.mdb")
iDbCodeTables = dbsAnother.TableDefs.Count
ReDim dbcodeTables(iDbCodeTables)
For i = 0 To dbsAnother.TableDefs.Count - 1
For Each tdf In dbsAnother.TableDefs
dbcodeTables(i) = tdf.Name
Next tdf
Next i
Set dbs = Nothing
Set dbsAnother = Nothing
End Function
My code so far is :
Public Function getTables()
Dim wsp As Workspace
Dim dbs As Database, dbsAnother As Database
Dim tdf As TableDef
Dim iDbCodeTables As Integer
Dim i As Integer
Set dbs = CurrentDb
Set wsp = DBEngine.Workspaces(0)
Set dbsAnother = wsp.OpenDatabase("S:\cadproj\DAILYREP\DATABASE\Liquidity\LiquidityMaster.mdb")
iDbCodeTables = dbsAnother.TableDefs.Count
ReDim dbcodeTables(iDbCodeTables)
For i = 0 To dbsAnother.TableDefs.Count - 1
For Each tdf In dbsAnother.TableDefs
dbcodeTables(i) = tdf.Name
Next tdf
Next i
Set dbs = Nothing
Set dbsAnother = Nothing
End Function