restrict max number of records for a customer

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

how do i create a table for a online shopping so that each customer can only
buy a max of 5 objects. I like to do it so that the max amount can be
changed easily in the future.

thankx in adv
 
john said:
how do i create a table for a online shopping so that each customer can only
buy a max of 5 objects. I like to do it so that the max amount can be
changed easily in the future.

thankx in adv

One way: set up a table (MaxObjects) with one field (MaxObject) and one
record, which you set to 5. Include logic in your AddObjectsToOrders
routine that looks at this value before a new order object is created.
 
Is there no other of way of doing this? id prefer it if there was a
validation rule or coding to correct this problem
 
john said:
Is there no other of way of doing this? id prefer it if there was a
validation rule or coding to correct this problem

:

Sure, a "hard coded" validation rule in code could do the same thing.

You mentioned "changed easily in the future", which is why I suggested
building a simple table. The validation rule can use the table data. If
the business rule changes later you can easily update the table (e.g.,
through an administrative form).

Putting the limit in the code may be more difficult to maintain
depending on your circumstances.

Hope this helps!
 

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

Back
Top