PDA

View Full Version : limits for maximum values of each field



alfaomegas
09-13-2013, 05:17 AM
Hi everybody I looking for a solution to my problem. I have a access database and I have to put some limits for maximum values of each field. Let’s say there is lots of different customers and they have some limit numbers of orders, which they can order. For each customer is this limit different. I want to keep adding new orders till the limit is reached and then can’t be add any more numbers for new orders for each customer. Is there any way how I can set in access database this limits? and that access doesnt alowed to go over the limit? what function or VBA I have to use?


Thank you for any help in advance.



10582

macb
09-15-2013, 04:17 AM
Hi

I am not sure about the structure of your Database and tables. I assume that you have properly designed table and forms for data entry. If so try the following.

I hope you have a table for your “order entry”, another table with customerid and limit. Hope you are inputting the orders into the order table through a form. If so, create two textboxes on the same form. On the first text box, bring the limit using Dlookup function from “Limit Table”. On the second text box bring the sum of the total orders using Dsum function from your “Order table”. When you click the button to add your new entry to Table Orders, check both these value and continue if conditions are met other wise use a warning message and stop addition of the new entry.
Regards

Mac

alfaomegas
09-17-2013, 01:19 AM
Hi Mac,

Thanks so much for your comment and for your explanation. The database is actually way more difficult and those data are not already in tables, but I have them in queries...is kind of sum of all orders from one customer...because he has more things he can order...so is getting complicated.

So I don’t know how to exactly bring the data with the dsum and dlookup functions...because is part of query and this looks is works only for tables...

Is there any other option?

Thank you so much in advance and wish you a great day

alfa

mrojas
09-17-2013, 05:18 AM
Could you share with us some forms' screenshots?

alfaomegas
09-18-2013, 06:18 AM
Hi there, finnaly I move little in front and get to next problem haha...still even before I will be able to set by some VBA code the function for limit. I have a form now with all entry data, now I add to this form two new fields. One of them is max order count. and the second is suma of actual orders(which I add by the combobox, because is alredy part of query). So I have now all this data in one form, but now new problem show up. Im not able to add new record. Is give me this: you can't go to the specified record.

I try to deal it by all ways...but I dont know why i cant put in new record. So I cant even continue trough that

do you have any idea? thank you so much in advance