title: Copy in Access using VBA
body: <p>I created a copy button in an Access form to copy the Data in the fields that users enter so they can paste it in an internal system.</p>
  
  <p>I created VBA code "on the click: </p>
  
  <pre><code>Private Sub Command6_Click()
       On Error GoTo Err_cmdDuplicate_Click
       DoCmd.RunCommand acCmdSelectRecord
       DoCmd.RunCommand acCmdCopy
  
       Exit_cmdDuplicate_Click:
       Exit Sub
  
       Err_cmdDuplicate_Click:
           MsgBox Err.Description
           Resume Exit_cmdDuplicate_Click
  
   End Sub
  </code></pre>
  
  <p>I am having 2 problems:<br>
   it copies all the data with the headers but pastes it vertically rather than horizontally. I guess it needs to be formatted. I have to add since the code was grabbing everything in the form even the information that I didn't want. I created a query then a report based on the query then made the copy button with the code behind it.</p>