View Full Version : Number Increments


mugman17
02-27-2001, 05:53 AM
I want a form to keep count of a Deal ID field without using AutoNumber. So basically DealId = DealID +1 once the form moves to a new record. Where would I put this? I cannot seem to get anything but zero.

Abby N
02-27-2001, 06:27 AM
Hello. The following line of code will do what you're looking for. However, you should be aware that this will only work if the code exists on all forms used to create records and records are not created directly in the source table. That said, use the following line of code in the forms 'Before Insert' event.

Me.DealID = DMax("[DealID]", "[TableName]") + 1

You may also want to set DealID's 'Enabled' property to 'False' to prevent useres from changing the value. Good Luck.