Generate next number that starts with a letter

A

AnnieJ

I have a field with despatch note numbers, each number starts with a D, e.g.
D1234,D1235,etc. I want to generate the next available number, ie Dxxxx + 1.
I have tried and failed with DMax, I know this works with only numbers but
get an error when there is a letter. Is it possible to generate next number
while ignoring the D?
Thanks
 
D

Douglas J. Steele

You need to remove the letter D from the front (then add it back on:

"D" & CLng(Mid(Nz(DMax("[NameOfField]", "[NameOfTable"), "D0"), 2)) + 1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top