Run-time error '2046'

M

MiG

When I use this code DoCmd.RunCommand acCmdCopy in the -On Get Focus- event
of a combo box record (possible in the case of cmb?), it generates this
error!! Any thoughts on why this occur? Thanks, MiG
 
M

Michael H

Hi.

Are you trying to copy the current record to a new record? I'm not sure why
you would want to do this in the Got Focus event, but:

To copy a record (much like copying a file, or some text) you have to first
select the record, then copy, then paste. Error 2046 is "The command or
action 'Copy' isn't available now.", and the probable reason why the command
isn't available is that there is no record selected. Try substuting your one
line with these three:
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdPasteAppend

-Michael
 

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