How sum a value directly from the table where equal to a subform c

L

ldiaz

Hello all.'

I would like to have this in an before event.

Dim StrProducedQty as string

I don't know how get this sum...
StrProducedQty = sum [Produced_Qty] from table [tbl_WOProduced] where
[tbl_WOProduced] is equal to this control on the subform (Work_OrderN)

Note: These are my forms and subform names.
FormName: frm_Production_Report
SubformName: sfrm_WOProduced

If StrProducedQty + me.Produced_Qty > WOQty Then
MsgBox "Qty exceed the valance of the WO, type a lower value than the
valance", vbCritical, "Qty exceeded"
Cancel = True
End If
 
T

Tom van Stiphout

On Wed, 6 May 2009 19:22:07 -0700, ldiaz

You can get the sum using the DSum function - see help file.

-Tom.
Microsoft Access MVP
 
L

ldiaz

that does not work if I want to eliminate extra fields on the subform..

I want a string

--
Lorenzo Díaz
Cad Technician


Tom van Stiphout said:
On Wed, 6 May 2009 19:22:07 -0700, ldiaz

You can get the sum using the DSum function - see help file.

-Tom.
Microsoft Access MVP

Hello all.'

I would like to have this in an before event.

Dim StrProducedQty as string

I don't know how get this sum...
StrProducedQty = sum [Produced_Qty] from table [tbl_WOProduced] where
[tbl_WOProduced] is equal to this control on the subform (Work_OrderN)

Note: These are my forms and subform names.
FormName: frm_Production_Report
SubformName: sfrm_WOProduced

If StrProducedQty + me.Produced_Qty > WOQty Then
MsgBox "Qty exceed the valance of the WO, type a lower value than the
valance", vbCritical, "Qty exceeded"
Cancel = True
End If
 

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