look at 4 digits

N

NetworkTrade

have an autoincrement

Dim Job As Variant
Job = Nz(DMax("Job", "JobTable")) + 1

the data in the Job field is always an integer but the field has been
defined as a text field......so while the real fix is redefining that field
correctly ; sometimes the real world is not so ideal...

it works up to 999 and then as text sees 1000 as a lower value - it won't
increment....

the fix in maintaining the current system would be to look at only 4 digits
- ignoring 0-999 and then the increment up from 1000 will continue to 9999

(I did this once before some time back for a sequence that began with 3
letters and needed to ignore the first 3 letters but now can't remember the
technique....)...Would welcome a reminder. TIA
 
S

Stefan Hoffmann

hi,
Dim Job As Variant
Job = Nz(DMax("Job", "JobTable")) + 1

the data in the Job field is always an integer but the field has been
defined as a text field......so while the real fix is redefining that field
correctly ; sometimes the real world is not so ideal...
.... but still being wrong isn't that good.
it works up to 999 and then as text sees 1000 as a lower value - it won't
increment....
You may use

DMax("CLng([Job])", "JobTable")

on your own risk.


mfG
--> stefan <--
 
N

NetworkTrade

gracias......sure cast it as an integer since that's all they put in
there....should have thought of that instead of the look at 4 digits
approach.....will work beyond 9999 too....
--
NTC


Stefan Hoffmann said:
hi,
Dim Job As Variant
Job = Nz(DMax("Job", "JobTable")) + 1

the data in the Job field is always an integer but the field has been
defined as a text field......so while the real fix is redefining that field
correctly ; sometimes the real world is not so ideal...
.... but still being wrong isn't that good.
it works up to 999 and then as text sees 1000 as a lower value - it won't
increment....
You may use

DMax("CLng([Job])", "JobTable")

on your own risk.


mfG
--> stefan <--
 

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