dynamically limit records in subform

kgcrowther

Registered User.
Local time
Today, 03:09
Joined
Jun 1, 2001
Messages
52
I have a form with a sub form. The subform is in the default view "continuous forms" so that multiple items can be viewed at a time. I want to be able to specify how many items may be entered based on a number in the main form.

More specifically, we want to track our software. We want to keep track of software and hardware keys that are issued to employees so that we don't break any license laws. We own a different number of licenses for each type of software. I've set up the form so that main software information is in the main form and employee information is in the subform in continuous view so that you can see all the employees who have a key. (there is usually three to ten)

Does anyone have any ideas how to either limit the number of employee entrees, or at least give a warning message everytime too many are entered?

Any ideas will be helpful. Thanks.

Kenneth
 
You could use DCount in the On Current event of the form that is your subform to do a count of the records. If the count is equal to or exceeds the acceptable number you can pop up a message and then send the user back to the previous record thereby not allowing he/she to continue.

PS. Pat's idea of before insert is superior.



[This message has been edited by Jack Cowley (edited 07-19-2001).]
 
This works great. I'm wondering why it needs to be >=. I tried just putting > and it didn't work right. I would think in my mind that when they are equal I should still be able to enter (and I can still enter with the >= command) Does it start counting with 0 or something.

Well I guess it's not that important, because it does work. Thankyou very much,

Kenneth
 

Users who are viewing this thread

Back
Top Bottom