Count orderline's in sub form

  • Thread starter Thread starter Erik
  • Start date Start date
E

Erik

for 1 purchase i would like to count the amount of
orderline's
This is a master/ detail form, can i make a field on the
subform that count the amount of orderline's and give's me
a popup if more than 4 line's are filled ( on the save
botton )

Thanks in advance

Erik
 
Erik said:
for 1 purchase i would like to count the amount of
orderline's
This is a master/ detail form, can i make a field on the
subform that count the amount of orderline's and give's me
a popup if more than 4 line's are filled ( on the save
botton )

Set the controls' ControlSource to

=DCount("*","yourtable", "purchasekeyfield=" & parent!purchasekeyfield)

(refer to the Parent for the case your subform is in an empty record)

I suggest you do not check from the Save button since Access does mostly
implicit saves, you would not get those. Instead, use the AfterInsert
event of the (sub)form.

[OT suggestion: don't overdo the ', it's "orderlines" and "gives"]
 
Back
Top