I want to build an array or something like that to rationalize my function. The function must first detect any database called
DepotSo,DepotVa,DepotBl, etc, i have about 14
If the database is detected then the function FromDepot is triggered importing tables depending on the source.
Public Const DSo As String = “C:beDepotSo.mdb”
Public Const DVa As String = “C:beDepotVa.mdb”
Public Const DBl As String = “C:beDepotBl.mdb”
etc
etc
Public Function FncCollectFromDepot()
‘ import the tablles from any available Depot, and after that deletes
this depot
‘******************** Stuttgardt
If Dir(DSo, vbNormal) “” Then
Call FromDepot(DSo)
UpdateTables
Kill (DSo)
End If
‘******************** Beograd
If Dir(DVa, vbNormal) “” Then
Call FromDepot(DVa)
UpdateTables
Kill (DVa)
End If
‘******************** Nish
If Dir(DBl, vbNormal) “” Then
Call FromDepot(DBl)
UpdateTables
Kill (DBl)
End If
‘******************** Berlin
If Dir(DHa, vbNormal) “” Then
Call UnleashDepot(DHa)
Call FromDepot(DHa)
UpdateTables
Kill (DHa)
etc
etc
End If
End Function
Public Function FromDepot(appath As String)
DoCmd.TransferDatabase acImport, “Microsoft Access”, appath, acTable, “Customers”, “Customers1”
DoCmd.TransferDatabase acImport, “Microsoft Access”, appath, acTable, “order details”, “order details1”
DoCmd.TransferDatabase acImport, “Microsoft Access”, appath, acTable, “orders”, “orders1”
End Function
So i want to build my function FncCollectFromDepot so as to evade the enumeration of each database separately for example
If Dir(DSo, vbNormal) “” Then
etctect
ant to obtain a global code.
I will be grateful for any help in this respect