Full Version: Limit Available Entries - Best Way
UtterAccess Forums > Microsoft® Access > Access Forms
mkcat
Hi,
I'm starting out with a combobox on a continuous subform.
Oselect a type (value list, 3 choices only) and a date for each type.
I want to limit the number of lines to 3.
I have my table limited by primary key so I know I can't enter more than 1 of each type.
After I add 1 of each type on my form, the form then brings up a 4th line.
Is there a way to NOT get this 4th line?
FOr Should I just use .visible with each line on a single form?
Is there a better way to handle this?
thanks for any help
AC2Designs
The 4th lines comes up because the form or subform is set to .AllowAdditions = Yes
If course you need this to add records via the Form/subform.
I would do one of 2 things:
1. Add a record count after each record is added (in Form_Afterupdate), and if the REcordcount = 3 then set allowadditions = No
2. Turn AllowAdditions to No and add a Button to create each record, the button will first turn AllowAdditions On. After the record is added (Form_AfterUpdate) set the AllowAdditions off again
There may be better ways, but I have used both of these and like them.
Hope that helps
Kevin
mkcat
Thanks Kevin
I'll try that.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.