Number Increments

mugman17

Registered User.
Local time
Today, 14:22
Joined
Nov 17, 2000
Messages
110
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.
 
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.
 

Users who are viewing this thread

Back
Top Bottom