The information in this article applies to:
SYMPTOMS
Moderate: Requires basic macro, coding, and interoperability skills.
CAUSEIn Microsoft Access version 1.x, the Counter field was Null until the record was saved (that is, until you moved to the next record, or clicked Save Record on the File menu). Therefore, if you checked the Counter field (using the IsNull() function) and it was Null, then the record being edited was a new one. If not, then it was an existing record. The usual method was to put the following expression in the form's BeforeUpdate property: IsNull([<counterfieldname>])In Microsoft Access 2.0 and later, however, the AutoNumber (or Counter) field is updated as soon as you begin inserting a new record, which invalidates the method described above for Microsoft Access version 1.x. RESOLUTIONIn Microsoft Access 7.0 and 97This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual.There is a property called NewRecord. You can check this property in the BeforeUpdate event of the form to determine if the record is a new one. For example:
In Microsoft Access 2.0To determine if the current record is a new record using a Counter field in Microsoft Access 2.0, you can check the OldValue property. The OldValue property will return Null for a new record.To do this, use the following expression in the form's BeforeUpdate property: IsNull([<counterfieldname>].OldValue)For another technique that does not require the use of a Counter field, please see the following article here in the Microsoft Knowledge Base: Q112292 ACC: How to Determine if the Current Record Is the New Record REFERENCES
For more information about the NewRecord property, search the Help Index
for "NewRecord property."
Additional query words: forms
Keywords : kbusage FmsHowto |
Last Reviewed: October 13, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |