Default value in new table record

Pettor

Board Regular
Joined
Aug 8, 2015
Messages
175
Hello guys, I have a table and I would like every new row at a specific column to get by default the number of the previous row +1. Is it possible?
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hello guys, I have a table and I would like every new row at a specific column to get by default the number of the previous row +1. Is it possible?
Yes. at the second row of Specific Column( I suppose it is column D) Write = Above Cell + 1

for example if your table first row after header is Row 2 & Specific Column is column D then
you write at D3 = D2+1 then autofill down
 
Upvote 0
How this should work? I could place it as a "default value" code I guess, either in the form field or in the table one?
 
Upvote 0
I don't think that maabadi realized that you posted this in the Microsoft Access Questions forum and gave you an Excel answer.

Access works very differently than Excel. The records really have no order within a table. Someone once gave a good description, saying think of records in a table like a bag of marbles, all jumbled up. So there really is no relative position of one record, as compared to another. If you were to sort them in a query, you could them loop through them in whatever sort order you determined.

To do what you want, you would use VBA that says every time a new record is added, find the maximum value in that field, and add one to it.
If you control all new record entry through a Form, you can just add the VBA code when a new record is submitted.
If you import the records, you can run some VBA scripts after import.

Note that users should NEVER enter records directly into the Table. You want to control all their data entry via Forms.
 
Upvote 0
Hi guys, case solved. I used the Dmax function in the default property of the form. Thank you All!
 
Upvote 0
Solution
Hi guys, case solved. I used the Dmax function in the default property of the form. Thank you All!
Good to know that you can do it that way too, instead of using VBA!
Glad to see you are controlling it through Form entry, though!
 
Upvote 0

Forum statistics

Threads
1,223,460
Messages
6,172,334
Members
452,454
Latest member
MadamRedRabbit

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top