Hi Alfaomegas,
Sure. Lots of 'em.
This might work...
Add a MaxOrderCount integer field to your customers table and enter values for all the customers.
Put OrderCount into your form's RecordSource as a dependent field that is computed by counting orders. Do something like this for every limited field. For OrderCount, it'll be =DCount("OrderID", "tblOrders","CustomerID=" & [CustomerID])
Put =EnforceLimit("OrderCount") into the cboCustomerID AfterUpdate event. You put it here because you want to alert your users as soon as possible so they don't have to fill out the whole order before being told the customer can't order anything.
Add this code
Code:
Function EnforceLimit(FieldName as String)
If Me("Max" & FieldName) = Me(FieldName) then
MsgBox "Sorry. This value for " & FieldName & " has reached its limit."
Docmd.Cancelevent or ActiveControl.Undo or ActiveControl= ActiveControl.OldValue.
' I always tear out hair getting Access to undo things the way I want. One of these should work.
End if
End Function
Then do the same for the other controls.