Deleting table contents whilst in drag n drop



I am using a 2nd party drag and drop module.
Whilst displaying the form where I drag and drop from source table to target
table, I wish to delete the contents of the target table.

So I use the following code on a button:
Private Sub Command36_Click()
DoCmd.RunSQL "DELETE * FROM orders;"
End Sub

After I press the button, I get the warning about deleting the records, I
press YES.
The contents of the target table are still present until I click within the
target table area. And now, the contents are now empty.

I am guessing a "refresh" is required, is there a further command that will
save the user from mouse-clicking on an area of a form to refresh the display?




Allen Browne

Requery the form after the delete, e.g.:
or if it is a different form:

IMHO, Execute is better than RunSQL because:
a) it avoids unnecessary dialogs,
b) you can get feedback about whether it worked (using dbFailOnError),
c) you can use transactions if you wish.

Details in:
Action queries: suppressing dialogs, while knowing results

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question