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

Hi

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
                Stop
                    If blnDeletePreviousTable = True Then
                        db.TableDefs.Delete (oNewTable)
                        db.TableDefs.Refresh
                        Exit For
                    Else
                       'Do not delete
                    End If
                End If
            Next
    End If

Open in new window

Microsoft AccessVBA

Avatar of undefined
Last Comment
Murray Brown

8/22/2022 - Mon