Hello all,
I have a seriese of excel VBA tools which I have put together for a series of functions for other users within my company to use and need to add the following functionality to it
Point to a directory of .mdb access files with various names
Always with the same table name "TREES" I need to remove the first columbn a primary Key "MAPINFO_ID"
The following is my attempt can someone tell me what more I need to know to get this functional, thank you for taking the time to read this post
<code>
Sub Drop_Mapinfo_ID_Test()
Dim db As Database
Dim T As TableDef
Dim MyDir, MyMDB, MyN, MyM, MyListCell, MyMDBCell As String
Dim n As String
' Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Columns("R:R").Select
Selection.ClearContents
Application.ScreenUpdating = False
MyDir = Range("J3").Value
MyMDB = Range("J4").Value
'Set result cell count
n = 4
MyN = n
MyListCell = "R" + MyN
Range("J4").Select
Do Until IsEmpty(ActiveCell)
MyMDB = ActiveCell
Set db = OpenDatabase(MyDir + "/" + MyMDB)
'Set DB = OpenDatabase(GetFilename())
For Each T In db.TableDefs
T.Fields.Delete "MAPINFO_ID"
Next
ActiveCell.Offset(1, 0).Select
Loop
End Sub
/<code>


Reply With Quote
