copy copies fields from multiple records

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

Guest

I want to copy data in certain fields from one form and paste it into certain
fields in a new record on a separate form. Currently, I can copy the correct
info if only one record is showing on the first form, but data from multiple
records copies if there is more than one record showing. Any suggestions?

thanks!
 
Copy/Paste is not the right way to do that. You should be using some
simple VBA code to "copy" control values, triggered either by the event
(command button?) on the first form which opens the second one, or the
second form's On Open event (if this is the only way the second form is
opened). Assuming the former case, there is a line of code in the
command button's Click sub like:

DoCmd.OpenForm stDocName, , , stLinkCriteria

or something like that, starting DoCmd.OpenForm. This line should be
followed by one line for each control value you need transferred along,
like:

Forms![Form2].[Text1] = Me.TextA

etc. where Form2 is the name of the second form, and Text1/TextA are the
names of the corresponding controls on forms 2 and 1 respectively.
Substitute as per the actual form and control names.

If you opt for the seond form's Open event, it's the other way around:

Me.Text1 = Forms![Form1].[TextA]\

In either case, the reference to TextA in Form1 will always return the
value of TextA in the record currently selected in Form1, regardless of
the number of records in it, or the first record if none manually selected.

HTH,
Nikos
 
Back
Top