Obtain the same value of the form in a subform

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
 
P

PJFry

What is not working about PTotal ? Is it giving you the wrong answer or no
answer at all?
 
J

John B

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top