Obtain the same value of the form in a subform

  • Thread starter Thread starter John B
  • Start date Start date
J

John B

In a form called "Order" I have a text box to count the number of product
of the subform "Product_List":
=[subform Product_List].Form.RecordsetClone.RecordCount
and it works: for example 3.

On the same form "Oder" I have another subform named "subform_Product_Oder"
and if is possible, I would like that, when I select the description
"Shipment Fee", in the field "Quantity" appear the same value of above, in
this case 3 (Total of Product List)

I tried the following code, on the BeforeUpdate event of "Quantity" text
box, but it doens't work. Any help please?


Private Sub Quantity_BeforeUpdate(Cancel As Integer)
Dim PTotal As Long
PTotal = DCount("ProductID", "Subform Product_Order", "")

If Me!Description = "Shipment Fee" Then
Me!Quantity = PTotal
End If
End Sub

Thanks for Your help.
Regards
John
 
What is not working about PTotal ? Is it giving you the wrong answer or no
answer at all?
 
Hi,
I solved in this way:

Dim PTotal As String
PTotal = [Forms]![Order]![Total]

If Me.ProductName = "Shipment Fee" Then
Me.Quantity = PTotal
Else
Me.Quantity = 1
End If

Thanks. Probabily I need to learn more about form and subform links
criteria.
Regards
John B
 
Back
Top