copy record from one form to another form

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

Guest

I have code running that copies data from one form onto another form;
however I need to make sure that the information is only copied to a new
record so that the user can not copy information over an existing record.
Below is the code that I currently have, how to I make sure they are on a new
record only?

IF Currentproject.AllForms("frm1").IsLoaded Then
Forms!frm1.fname = me.firstname
.......
End If
 
Rather than copy data from one form to another, you should append the data
in the one form to the other form. Appending always creates a new record of
the appended data. To do an append, create a query based on the recordsource
of the form you are currently copying from that includes the fields you want
to copy to the other form. Set appropriate criteria so you only get the data
of the selected record you want to copy over. Change the query to an append
query setting append to to the recordsource of the form you are currently
copying to. Now your code needs to look like:
IF Currentproject.AllForms("frm1").IsLoaded Then
Code to Exceute Append query
......
Code to requery the form you currently are copying to
End If


PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
I have code running that copies data from one form onto another form;
however I need to make sure that the information is only copied to a new
record so that the user can not copy information over an existing record.
Below is the code that I currently have, how to I make sure they are on a new
record only?

IF Currentproject.AllForms("frm1").IsLoaded Then
Forms!frm1.fname = me.firstname
......
End If

Bear in mind that data is NOT stored in Forms. It's stored in Tables, and only
in Tables.

Either run an Append query, or open a Recordset based on the second form's
table, and add the data to that.


John W. Vinson [MVP]
 
Back
Top