Delete Command Button - Best method SQL or acCmdDeleteRecord?

J

Joaquin

I've seen two ways to delete a record:

1.) DoCmd.RunCommand acCmdDeleteRecord

2.) DoCmd.RunSQL ("DELETE FROM MY_TABLE WHERE
[frmMyForm].Form![PRIMARY_KEY]=" +
Str(Me.tbxPrimaryKey))

I assume that the first only works on the current record a form in focus and
the second could potentially delete multiple records on other recordsets. ??

I was wondering if these asumptions are accurate and whether there are other
advantages to either in the context of the following form events:

- On Delete
- Before Del Confirm
- After Del Confirm

Thanks in advance for your consideration.
 

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

Top