Code to copy from subform to subform?????

JustMaybe

Registered User.
Local time
Today, 09:06
Joined
Oct 18, 2002
Messages
134
Hi all!

I have what I hope is a very simple problem!..Within my database I have an order form. This is filled out by an administrator and then a Purchase Order is raised to our suppliers. When the Purchase Order Form is opened from the Order form I use the following code to copy across some of the more important details.
Private Sub Purchase_Orders_Click()

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "PurchaseOrder"
'
DoCmd.OpenForm stDocName, , , stLinkCriteria
'
[Forms]![PurchaseOrder]![EndUser] = [Forms]![Orders]![EndUser]
[Forms]![PurchaseOrder]![OrderID] = [Forms]![Orders]![OrderID]
[Forms]![PurchaseOrder]![Reseller] = [Forms]![Orders]![Reseller]
If MsgBox("Do you wish to copy the customer information from the order form?", vbYesNo, "Time to make a decision....") = vbYes Then
[Forms]![PurchaseOrder]![MemoField] = [Forms]![Orders]![InformationToAdd]

Else
[Forms]![PurchaseOrder]![MemoField] = [Forms]![PurchaseOrder]![MemoField] = False

End If

However it would also make more sense to copy over the details of the products ordered in the ‘Orders subform’ to the Purchase Order subform. As the purchase order is raised using dollars this raises a different amount from the ‘Product ID’ than on the order form (processed in sterling)..so all I figured I had to copy over from the orders subform was this Product ID.

However when I went to do this I found that it wasn’t as simple as

[Forms]![PO_Subform]![ProductID] = [Forms]![O_Subform]![ProductID]

…I kept getting errors that the form O_Subform doesn’t exist and errors such as ‘ProductID’ not recognised as I played with the problem…..

…can anyone tell me what I’m missing…as its also more than one item in ProductID would this cause a problem too?????????

Thanks so much in advance to anyone who can help.
 
Have a look at the attachment here as it helps with referencing subforms on different parts of a form.
 
Thank you soooo much!!...exactly what i needed (i hope!)..am printing a copy now!!

Sarahx
 
how to select sub form items to be copied over

I have a similar problem, however i need to be able to select various items from the sub form to be copied over, is this possible?. I was thinking of using a combo but can you copy from a combo to a sub form?
 

Users who are viewing this thread

Back
Top Bottom