Link to home
Start Free TrialLog in
Avatar of Jegajothy vythilingam
Jegajothy vythilingamFlag for United States of America

asked on

Access 2016

My OS is win 10 pro 64 bit and I have Office 365 and use Access 2016.
I have created a simple Form with a command button to add new records.  While it works.  But I want to increase the number by one.
The name of the field is : Numb, and it is an integer.  the name of the table is tblJasonJustin.  In one of the previous code, I saw the following:
DMax("Numb", "tblJasonJustin")
But I do not know how to integrate this code into the command button, which is a Macro to add new records.
Your advise will be very much appreciated. thank u.
ASKER CERTIFIED SOLUTION
Avatar of bfuchs
bfuchs
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You may be going about this the hard way.  If you always want new records to add and incriment by 1,  Modify the datatype of the Numb field in tbljasonjustin to AutoNumber with new value set to incriment
Avatar of Jegajothy vythilingam

ASKER

In response to bfuchs, I inserted a command button, but the On Click event is a macro.  How do I change this to an Event Procedure so that I can put this code?  thank u.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In response to bfuchs, thank u for the information, I see that.  It creates a macro by default.  But is there anyway if we can get it to create an Event Procedure with the VB code instead. thank u.
As stated above, once you enter that property it should give you a drop down with an option to select event procedure.
I used bfuchs' solution because of its simplicity and ease of understanding the logic. thank u.