copy and paste

John thomas

Registered User.
Local time
Today, 14:16
Joined
Sep 4, 2012
Messages
206
I want to copy and past automatically using a macro .I have a sub form and i want to copy a date into varous other positions after i have entered info into the proceeding field a
 
Whilst this can be achieved, it is just as easy to use the built in right click menu or keyboard shortcuts CTRL + C to copy and CTRL + V to paste. You can also use the copy above CTRL + @ keyboard shortcut to copy the value from the same field in the precedding record.

The only advantage to setting up a macro/vba code is of you were pasting to multiple fields at the same time.
 
Many thanks but i really need to automate it
What is the best way of doing this
 
You could do this in the AfterUpdate event of the control the user will enter the data. OR you could add a command button so the user can control this action.
Either way the VBA the code would look something like:

If the field/control you are copying from is on the same form as the field/control you are pasting to then:-
Me.NextField/ControlName = Me.OriginalField/Control
Me.NextField/ControlName1 = Me.OriginalField/Control
etc

If the field/control you are copying from is on the Main form and the field/control you are pasting to is on the subform then:-
Me.SubFormName.Form.NextField/ControlName = Me.OriginalField/Control
Me.SubFormName.Form.NextField/ControlName1 = Me.OriginalField/Control
etc

If the field/control you are copying from is on the Sub form and the field/control you are pasting to is on the Main then:-
Forms!MainFormName.NextField/ControlName = Me.OriginalField/Control
Forms!MainFormName.Form.NextField/ControlName1 = Me.OriginalField/Control
etc
 

Users who are viewing this thread

Back
Top Bottom