Access 2007 - Copy Control and Label



In Access 2003, if I selected the text box and the label in a report
(tablular format) and copied and pasted, it copied on top of the selected
controls and I could move them as a pair to the left or right. In Access
2007, it copies BELOW, messing with the detail and page headers. What am I
doing wrong?


Jeanette Cunningham

Hi Rebecca,
you're not doing anything wrong. This is how it works in A2007.
I haven't found any method that doesn't copy below when copying both control
and label at the same time.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Hi Rebecca,
If you still want to have your controls pasted at the top of section, you
might want to try the following:

- create the following function in a separate module:
Function fPasteSelectedControlsTop()
Dim ctl As Control

On Error Resume Next
If Screen.ActiveForm.CurrentView <> 0 Then Exit Function
DoCmd.RunCommand acCmdPaste
For Each ctl In Screen.ActiveForm.Controls
If ctl.InSelection And ctl.ControlType <> acLabel Then
DoCmd.SetProperty ctl.Name, acPropertyTop, 0
If ctl.Controls(0).Name <> "" Then DoCmd.SetProperty ctl.Controls
(0).Name, acPropertyTop, 0
Exit For
End If
End Function

- create AutoKeys macros (if you do not have one), and call the above
function from it:
^{F5} RunCode fPasteSelectedControlsTop

(you can change Ctrl+F5 shortcut to whatever you prefer)

Now go to your form's design view and copy control; then press Ctrl+F5 to
paste it together with its associated label (if any) at the top of section.

You might want to modify the code (just comment or delete Exit For line) to
be able to paste several control-label pairs at a time, but they will be
pasted one over another at the top of section.
(Actually I guess that is the reason why MS decided to paste controls to some
free space..)
So my advice is to copy/paste controls one by one.

Hope this helps..

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