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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying subform records to a new subform

Status
Not open for further replies.

mike0680

Technical User
Feb 17, 2003
28
GB
I'm still trying to copy details from a form and subform (fixed price list of around 200 options) to a newly-created different form and subform.

The main form, as it's only one record copies over perfectly, but the subform, which contain 4 to 10 records, only copies the first record. The code I'm using:

DocName = "New Service Loading - add"
DoCmd.Close A_FORM, "New Service Loading"
DoCmd.OpenForm DocName, , , , A_ADD
Forms![ServiceLoading]![jobref] = Me![jobref]
Forms![ServiceLoading]![Model] = Me![Model]
Forms![ServiceLoading]![servjob] = Me![servjob]
Forms![ServiceLoading]![labrate] = Me![labrate]
Forms![ServiceLoading]![labhrs] = Me![labhrs]
Forms![ServiceLoading]![labcost] = Me![labcost]
Forms![ServiceLoading]![wasteoil] = Me![wasteoil]
Forms![ServiceLoading]![Sundries] = Me![Sundries]
Do
Forms![ServiceLoading]![slsubform]![partid] = Me![fpsubform]![partid]
Forms![ServiceLoading]![slsubform]!{qty] = Me![fpsubform]![qty]
Forms![ServiceLoading]![slsubform]![BinLocation] = Me![fpsubform]![Bin Location]
Exit Do
Loop Until Me![fpsubform]![qty] < 1

Frink came up with a good suggestions pasting in a SQL statement - but it didn't work.

Thanks for any help,


Mike

 
The Exit Do in your DO loop will cause you to write only one record, then it will exit the loop. Get rid of this line and see if it works.
 
Thanks - I tried that before and again just now.

When I run this event without &quot;exit do&quot; it brings up a run time error 3331 'save record first message' and highlights the line of code after &quot;Do&quot;.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top