View Full Version : Avoid storing null records


chickencat
01-07-2002, 02:51 PM
I have a form that tracks clients with several subforms (to record contacts, contracts, invoices, etc.). My problem is that when I move from record to record in the database and I am in a subform, a new null record is created for that subform. For example, although a client has no invoices, a null invoice is automatically recorded in the database if I am in that subform. I have tried using the required and allow zero-length strings properties to no avail. When I use these properties, I can't scroll from record to record in my subform because it says either the field is required (it wants me to enter a value before I enter on) or it won't allow a zero-length string for a field (I must have an actual string for that field). Why can't it just accept the fact that some clients don't have contacts, or invoices and not record a new (yet null) one every time I scroll through all my clients! Help!

Pat Hartman
01-07-2002, 05:51 PM
You apparently have code in the subform that is "dirtying" the subform record thus causing Access to attempt to save it when you exit the form.

Remove any code you have that places values into subform fields and move it to the BeforeInsert event. The code will then only be executed if some data entry field is modified by the user.