Next in sequence from short text possible?

TDC21

Board Regular
Joined
Mar 31, 2017
Messages
97
I have a form that is linked to our CONTACT table on a SQL server. The ID field is Short Text, though it follows a numeric convention

0000001
0000002
0000003

I am trying to create a default value for new entries which is the next in sequence "0000004", Is this possible?
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
if your data is in A1, A2, A3, then:
In A4, put =A3+1
This will show as 4
Then go to Format Cells, and change the cell format from General to 0000000 and it will display as the others?
Or maybe I'm misunderstanding?
 
Upvote 0
I think you missed that this is an Access question.
You need to know what the highest saved value is in the field and add 1 to that. DMax function should work on text fields that resemble numbers, so you could calculate the value using the value returned by the function as the starting point. What you need to consider is when to perform the calculation. At the beginning of record creation, which means that you start an entry, then I start one and we both get the same next number because your entry has not been saved yet? Now we have problems in a multi user environment with concurrent users in the same table. If that will never happen, then simple enough. Otherwise, you might want to either A) calculate the value and commit the record or B) do so only when the entire record is completed and saved as the final step. Then what about gaps due to deleted records? If that is of no concern, it helps simplify things a bit. There's a lot to consider what can happen when doing this sort of thing. You have to play out all the scenarios to figure out the best approach.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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