×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

The command "SelectRecord" isn't available now HELP!

The command "SelectRecord" isn't available now HELP!

The command "SelectRecord" isn't available now HELP!

(OP)
Hello all,

I'm having a really irritating problem and I haven't been able to find a solution anywhere on the web.   I'm using Access 2003 and I have a form thats controls are bound to a simple table.    

I created a "duplicate record" button using the wizard, and then tweaked the code just a little bit in my attempts to fix the problem:

Private Sub btn_Duplicate_Click()
On Error GoTo Err_btn_Duplicate_Click
    
    If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord

    'Duplicate the record
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append

    'Focus on the Scenario ID, it needs to be changed to make the record unique
    Forms![frm_LOPA_Master].[Scenario_ID].SetFocus

Exit_btn_Duplicate_Click:
    Exit Sub

Err_btn_Duplicate_Click:
    MsgBox Err.Description
    Resume Exit_btn_Duplicate_Click
    
End Sub


The code used to work correclty, but at some point I made some changes to the form properties, other control properties, or something else messed things up.   When I click the "Duplicate Record" button, Access creates a new record, but none of original records values are carried over.  No errors are trapped.

If I put a break in the code and then step through, an error is trapped at the line: "DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70".   The error message is:

The command "SelectRecord" isn't available now

I've tried using the following code as well, but I have the same problem:

   DoCmd.RunCommand acCmdSelectRecord
   DoCmd.RunCommand acCmdCopy
   DoCmd.RunCommand acCmdPasteAppend

Does anyone know what causes a command to be unavailable?   I've had this same problem while trying to "undo" because there was nothing to undo, but that was easily remedied by putting a "If Me.Dirty" condition in.   What about selecting a record though; what could prevent a record from being selected?

Regards,
Seth



 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

White Paper – Data Security and Know-How Protection
Our data is constantly exposed to the danger of being intercepted or stolen as it wends its way over global data networks. Data security measures and measures for protecting intellectual property should not, however, first be implemented when data is exchanged – companies must lay the foundation for these measures within their own organization. Download Now
White Paper – Collaboration in the PLM Context
The influence exerted by the Internet of Things (IoT) means that there is a steadily growing need for collaboration in industry. Partners from new industries and areas of application need to be integrated in cross-company business processes to ensure that the lifecycle of smart, connected products can be managed from end to end. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close