I have a subform with a field called "REMAINING PALLETS". In control source I have this look up formula:
=DLookUp("[CountofIdPEDIDOSPRODUCTOS]";"[SUMA PALETS]";"[PRODUCTOPEDIDO] = " & [Forms]![PEDIDOS]![PEDIDOSPRODUCTOS]![IdPEDIDOSPRODUCTOS])
I have another field in the same subform called "Nº DE PALLETS" and I would like to do the next conditional clause on dirty event in my subform to check if maximum pallets nº is correct:
If Me.[nº palets].Value < Me.[Remaining pallets].Value Then
MsgBox "ESTE PALET SOBRA" End If
and do not add the last record if the conditional clause matches
But It doesn't show any msgbox and the record adds up anyway I don't know why. Is It possible Dlookup control source doesn't allow lf clauses?
Such expressions are requeried after the code has run.
So include it in your code:
If Me.[nº palets].Value < Nz(DLookUp("[CountofIdPEDIDOSPRODUCTOS]", "[SUMA PALETS]", "[PRODUCTOPEDIDO] = " & [Forms]![PEDIDOS]![PEDIDOSPRODUCTOS]![IdPEDIDOSPRODUCTOS] & ""), 0) Then
MsgBox "ESTE PALET SOBRA"
End If