Unforgettable,
I think to keep things simple you should have two buttons for delete. One for a selected table and the other for all tables.
Are you sure that you want to actually delete tables and not just records? Deleting a table cannot be undone.
You could have a check box which decides which button is visible or have the check box select two different forms one for each type of deletion.
As far as displaying messages this is what I do to delete an entry in a table. Note this is not deleting table but you can use the idea.
procedure frmEditOrderQty_btnFrmAmendDeleteRecord_OnClick (Sender: TObject; var Cancel: boolean);
var
text : string;
btn :integer;
begin
//Make a message string - from edit boxes of item selected
text := 'ORDER ITEM '+#13#13 + frmEditOrderQty.edtfrmAmendDescription.Text +' x '+ frmEditOrderQty.edtNewQty.Text;
//First warning message with a cancel and OK button showing. Click cancel allows you to not delete in case of making a mistake.
btn := messageDlg('CONFIRM DELETION OF '+text,mtWarning, mbCancel+mbOK, 0);
//What to do if Cancel is selected - exit out of the code and close the form (in this case).
if btn = mrCancel then
Exit
else
begin
SQLExecute('DELETE FROM orders WHERE orders.id = "'+ intToStr(frmMain.tgOrders.dbItemID) +'"');
//Information message advising the record has been deleted.
ShowMessage(#13#13 + text + ' has been DELETED' );
frmMain.tgOrders.dbupdate
end;
frmEditOrderQty.Close;
end;
The SQL code needed to delete a table is SQLExecute('DROP your_table_name IF EXISTS');
The SQL code to delete all tables is more complicated, you actually might be better off by just issuing a command to delete the complete database file.
I'd recommend having a copy of your database file while you experiment with deleting tables. Also the above code needs to be changed slightly if your tables have foreign keys in them.
On a clear disk you can seek forever