Help

I

Igor

Hi,
DoCmd.RunCommand acCmdDeleteRecord
raises error: 2046 The command or action 'DeleteRecord' isn't available
now.
Why could it be?
Thanks
 
D

DebbieG

I think it's because you can't delete a blank record.

You might want to just trap this error.


| Hi,
| DoCmd.RunCommand acCmdDeleteRecord
| raises error: 2046 The command or action 'DeleteRecord' isn't available
| now.
| Why could it be?
| Thanks
 
N

Nick Coe \(UK\)

There seem to be differences in the way the Access UI tells
Jet to delete a row depending on how it's called.

If you want to stick with DoCmd then you could;
move your DoCmd delete somewhere else or
use the DoMenuItem method of DoCmd or
try to delete using the RunSQL method and an appropriate
SQL string.

Other than that you're into recordsets or running delete
queries.

Don't forget that you or Access may have locked the page of
records containing the row you're interested in.

Can't think of anything else at the moment.

--
Nick Coe (UK)
AccHelp v1.01 Access Application Help File Builder
http://www.alphacos.co.uk/ Download Free Copy

In Igor typed:
 
W

Wayne Morgan

Igor,

Are you running this code in the Click event of a button? If so, is there
any other code in that event? Where is the button located, is it on the form
you are trying to delete the record from?
 
W

Wayne Morgan

In that case, unless there is some other code that is interfering, I don't
know. I even checked to see what would happen if you were at a new, unsaved
record. But the code and toolbar button both deleted the new, unsaved
record. No error was generated.

Just to verify, the button is on the SAME form, not a subform or parent form
of the form that has the record you're trying to delete.
 

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

Similar Threads

Error 2046 1
DeleteRecord command failing 1
Zoom question 1
Delete Record 4
Run-time error on acCmdDeleteRecord 2
Delete record command not available 1
DeleteRecord 1
error 2046 2

Top