Run-time error '2046'

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
Back
Top