Copy fields from one record to another

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

Guest

I have a form. I would like to create a button, that will copy the data from
a set group of fields and then let the user find the record that they want to
paste the data to and then paste the data in the corresponding fields in that
record. I already have a Find button. If it is easier, there can be 2
buttons, copy and paste. I don't know if the copy button could copy the data
and then the user could use the existing Find button to find the record and
then the paste button could paste into the new record. Any ideas would be
great. Thanks. Matt.
 
you can try that, few stages
1. create varible in the form declaration
dim MyField1 as string,MyField2 as number, MyField3 as string .... (as many
that you need)
2. on the copy button assign the values from the fields in the form to the
variable you created

MyField1=me.Field1
MyField2=me.Field2
MyField3=me.Field3

you can copy only the records that are relevant

3. on the paste button enter the code.

me.Field1=MyField1
me.Field2=MyField2
me.Field3=MyField3

that way you can repeat the paste as many time that you would like with the
same values.
 
What is the best way to prompt the user if they really want to do this
procedure and then based on whether they answer yes or no, run the code or
exit sub? Thanks. Matt
 
On the onclick event of the paste button write the code

IF msgbox ("Continue with paste?",vbOKCancel)=vbOK then
me.Field1=MyField1
me.Field2=MyField2
me.Field3=MyField3
End If

When the user choose to cancel it would exit without the paste action
 
Back
Top