That's the ticket!
I would refactor the sub to use some basic error handling, object cleanup, and remove the DoCmds so you don't have to worry about setting warnings like so:
Code:
Private Sub cmdAppendAllDistinct_Click()
On Error GoTo ErrHandler
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim qry As String
Set db = CurrentDb()
qry = "DELETE * FROM 00_ALL_DISTINCT;"
db.Execute qry, dbFailOnError
For Each tdf In db.TableDefs
If Left(tdf.Name, 3) = "LK_" Then
'Mass APPEND query
qry = "INSERT INTO 00_ALL_DISTINCT ( TABLE_NAME, TARGET_VALUE, SOURCE, DATE_UPDATED ) " & _
" SELECT """ & tdf.Name & """ AS TABLE_NAME, TARGET_VALUE, SOURCE, DATE_UPDATED " & _
" FROM [" & tdf.Name & "];"
db.Execute qry, dbFailOnError
End If
Next tdf
'Throw message box to indicate record append status
MsgBox "All records were successfully appended to table [00_ALL_DISTINCT].", vbInformation, "Update Status"
ExitHandler:
Set tdf = Nothing
Set db = Nothing
Exit Sub
ErrHandler:
MsgBox Err.Description, , "Error #" & Err.Number
Resume ExitHandler
End Sub
* EDIT - Note: if there is a possibility that any of these tables could have a space in their names (they shouldn't) it wouldn't hurt to put square brackets around the table names. I've edited the code above to reflect that.