Avatar of Murray Brown
Murray Brown
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

Access VBA Delete link to table in Current database


I am trying to delete the link to a table in the current database using the following code but it doesn't seem to work

    Dim db As Dao.Database
    Dim tbd As Dao.TableDef

    If blnDeletePreviousTable = True Then
            Set db = CurrentDb
            For Each tbd In db.TableDefs
                If tbd.Name = oNewTable Then
                    If blnDeletePreviousTable = True Then
                        db.TableDefs.Delete (oNewTable)
                        Exit For
                       'Do not delete
                    End If
                End If
    End If

Open in new window

Microsoft AccessVBA

Avatar of undefined
Last Comment
Murray Brown

8/22/2022 - Mon