Now stuck on addong a new line!!..can it get any worse??

JustMaybe

Registered User.
Local time
Today, 22:46
Joined
Oct 18, 2002
Messages
134
Hi guys!! thanks to mile-o -phile's excellant subform syntax sheet...i discovered a line of code i needed to copy details from one subform to another...

thing is it only copies the first line of the subform...and there can be up to ten products....

Does anyone know how to support this bug??

I have tried the .addnew...but have been told that the object doesn't support this property or method!!

....can anyone enlighten me.....i swear my coding skills are getting worse and worse!!!


Thank you so much if anyone can help :rolleyes:
 
Show me your code. I'm assuming you'll need to setup some kind of loop.
 
Thanks alot for your help Rob!!

This is my code

Sarahx

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]
Forms!PurchaseOrder![PO Details Extended subform].Form!ProductID = Me.[Orders Subform]![ProductID]
'
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
'
End Sub
 
First thing I noticed is that you have a variable for the where clause in opening your form but you don't tell the program what that is. That won't cause problems because it's going to take that variable as a zero-length string, but I wasn't sure if you needed that.

Next question, you're copying data from one subform to another... are both subforms on the same form? And is there multiple records in each subform.

Looks like you're copying four fields then asking the user if they want to copy the fifth. If there are multiple records to copy does this question need to be asked separately for each record?
 
Hi, sorry if i haven't been completely clear!..I'm always a bit wobbly on explaining myself!!

Firstly the subforms are on different forms alltogether....

[Forms]![PurchaseOrder]![EndUser] = [Forms]![Orders]![EndUser]

PurchaseOrder and Order are the two main Forms

PO Details Extended Subform...Is the subform on PurchaseOrders
Orders Subform...Is the subform on Orders

I'm not copying multiple records because the system only generates about four orders a day..Each of these has a seperate Purchase Order...so only record is copied at a time. There is an 'additional info' field which i give the user the option to copy for the suppliers to see or not!

Thanks again for all your help
Sarah
 
Things are becoming clearer now. Is this a memo field on your subform. Not sure if this will work but give it a shot.

setup a string variable and set that equal to the field you need to copy. Then setup your if statement to set the value equal to the variable. Also, you don't need the else part in your statement.
 
Errmmm... think we've got things muddled now!!

Copying the memofield really isn't the problem!!...

the problem is when i copy a record from the orders subform to the PurchaseOrders subform ....

Forms!PurchaseOrder![PO Details Extended subform].Form!ProductID = Me.[Orders Subform]![ProductID]

This copies the product ID from one subform to the other...however if there is more than one record (ProductID) in the Orders subform the piece of code only copies across the first one....and i need up to 8 productIDs copied accross

....unless i've got my wires crossed
:)

sarah
 

Users who are viewing this thread

Back
Top Bottom