Count orderline's in sub form

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
 
B

Bas Cost Budde

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"]
 

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