Help !Docmd.domenuitem to delete record in a form???

A

Acie

I have a simple form that uses a table as the source. I'm
using Access97.

I have a button labled "Delete Record". When I press this
button it executes the following:

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

but it gives me the following error msg:

The command or action 'Refresh' isn't available now.

The funny thing is that this same commands work on another
form.

I looked through the MS knowledge base, and I swaped the
above commands for:

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord

and I get a similar message:
The command or action 'DeleteRecord' isn't available now.

The form has Modal = No, Popup = No.

Any ideas ???

Thanks,
Acie
 
A

Allen Browne

Look for reasons why the record cannot be deleted, e.g.:

- Is the form's AllowDeletions property set to No?

- Is the form based on a read-only query, i.e. you cannot delete records in
the query either?

- Does the form have focus?

- Is the form unbound?

- Are you at a new record?

- Is the record dirty?

- Are you using Access security, without delete permissions?
 

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