Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copying from one form to another

Status
Not open for further replies.

Bozette

MIS
Apr 1, 1999
43
US
I have an Order Form based on 3 tables (frmOrders). Users use it to input orders.
To look at previous orders for reference, rather than using 'Next' or 'Previous' I have a button that opens a form based on a parameter query. It's named frmJobNum and a user can type in a job number and to see the order info for a particular job
What I'm stuck on.. I'd like to be able to COPY the order they're looking at in frmJobNumber as a new record in frmOrders. Sometimes orders are so similar it's easier to copy than retype the whole thing.
I've got code that allows me to copy from WITHIN frmOrders and create a new record but I can't figure out how to get it to work from frmJobNum to frmOrders.
Any help would be appreciated.
 
In the Form You need create a recordset for both the
Tables u need to do

Make the Rst.AddNew for the table where record to be addred

Copy form the OtherRst to this and update.
OtherRst must run a query and open the same record that is shown in the Form

Also you can run a appened query if this is gotta same structure??

 
Thanks for the reply. I know very little about programming so am trying to find something to use as a basis and add what you recommend. I did find some code that copies recordsets from one form to a new record in the SAME form. I don't see any reference to tables (which you mentioned I'd need to create a recordset for) so maybe this code is going in the wrong direction. Is there some of it that's usable? At least a starting point? Thanks again

Private Sub btnCopyMain_Click()
Dim dbs As Database, Rst As Recordset
Dim F As Form
Set dbs = CurrentDb
Set Rst = Me.RecordsetClone

With Rst
.AddNew
!PurchaseOrder = Me!PurchaseOrder
!SuppliersRefNo = Me!SuppliersRefNo
!ShipDate = Me!ShipDate
!ShipTo = Me!ShipTo

.Update
.Move 0, .LastModified
End With
Me.Bookmark = Rst.Bookmark
Exit_btnCopyMain_Click:
Exit Sub

 
You have a bound form

So

Set Rst = Me.RecordsetClone
Makes a copy of the forms recordset


and this adds a duplicate record to same table

.AddNew
!PurchaseOrder = Me!PurchaseOrder
!SuppliersRefNo = Me!SuppliersRefNo
!ShipDate = Me!ShipDate
!ShipTo = Me!ShipTo

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top