create reference number based on old one...

  • Thread starter Thread starter Co
  • Start date Start date
Family said:
Wouldn't you need a formatting string to get that? Your post did not
include any.

Did you try it? I don't know how "000" in the _middle_ can be left out
without formatting. Only leading zeros would need a format string.

Dim newnumber, oldnumber As String

oldnumber = "2009000144"
newnumber = (CLng(oldnumber) + 1).ToString
MsgBox(newnumber) '=> "2009000145"

Maybe I missed the point. I read the OP's first post again but I'm still
looking for the problem. He clearly said he has a 4-digit year followed by a
6-digit number in a string. The number is to be incremented. Nowhere I read
that the current year should be taken into account.


Armin
 
Hi Armin,

May be his Dunglish (Dutch English) is more easier for me then for you but
the OP wrote.

"which is the year (2009) followed by a 6 figure digit "000100"

I understood from it a year in a string plus a 6 figur digit in a string.

As I write this I know that you are more strict then me and you are right it
is not exactly written, but this kind of sentenced do you not understand. I
know.

(I can see from words as "newKenmerk" that Co is a Dutch or maybe Afrikaans
speaker, "newKenmerk" is English combined with Dutch which even is not
Dunglish.)

Cor
 
Hi Armin,

May be his Dunglish (Dutch English) is more easier for me then for you but
the OP wrote.

"which is the year (2009) followed by a 6 figure digit "000100"

I understood from it a year in a string plus a 6 figur digit in a string.

As I write this I know that you are more strict then me and you are right it
is not exactly written, but this kind of sentenced do you not understand. I
know.

(I can see from words as "newKenmerk" that Co is a Dutch or maybe Afrikaans
speaker, "newKenmerk" is English combined with Dutch which even is not
Dunglish.)

Cor
 
Cor said:
Hi Armin,

May be his Dunglish (Dutch English) is more easier for me then for
you but the OP wrote.

"which is the year (2009) followed by a 6 figure digit "000100"

I understood from it a year in a string plus a 6 figur digit in a
string.

That's what I understand, too.
As I write this I know that you are more strict then me and you are
right it is not exactly written, but this kind of sentenced do you
not understand. I know.

?? I still don't understand what's wrong with my solution.


<quote>
I'm trying to create a function that will create a "reference number"
which is one higher then the latest one added.
The reference number consist of "2009000100"
which is the year (2009) followed by a 6 figur digit "000100"
The code must create the new reference number as : "2009000101"
</quote>

His reference number is "2009000100" which is a 4 digit year followed by a 6
digit number. The new reference number is to be "2009000101". I can read it
another dozend times, but that's exactly what my code does.
Which part do I misunderstand? I don't get it.


Armin
 
Cor said:
Hi Armin,

May be his Dunglish (Dutch English) is more easier for me then for
you but the OP wrote.

"which is the year (2009) followed by a 6 figure digit "000100"

I understood from it a year in a string plus a 6 figur digit in a
string.

That's what I understand, too.
As I write this I know that you are more strict then me and you are
right it is not exactly written, but this kind of sentenced do you
not understand. I know.

?? I still don't understand what's wrong with my solution.


<quote>
I'm trying to create a function that will create a "reference number"
which is one higher then the latest one added.
The reference number consist of "2009000100"
which is the year (2009) followed by a 6 figur digit "000100"
The code must create the new reference number as : "2009000101"
</quote>

His reference number is "2009000100" which is a 4 digit year followed by a 6
digit number. The new reference number is to be "2009000101". I can read it
another dozend times, but that's exactly what my code does.
Which part do I misunderstand? I don't get it.


Armin
 
Armin,

That is where I wrote you are more strict then me, I was reading between the
lines that the number exist from a year plus a serial number.

That means that he has to start every year again. I took for the year the
Now.year in my example, however that can be of course every variable from
four digits separated from the serial number.

But strictly is your example is in my opinion a correct answer on the
question from the Op and in nothing wrong.

Cor
 
Armin,

That is where I wrote you are more strict then me, I was reading between the
lines that the number exist from a year plus a serial number.

That means that he has to start every year again. I took for the year the
Now.year in my example, however that can be of course every variable from
four digits separated from the serial number.

But strictly is your example is in my opinion a correct answer on the
question from the Op and in nothing wrong.

Cor
 
Armin Zingler said:
That's what I understand, too.


?? I still don't understand what's wrong with my solution.


<quote>
I'm trying to create a function that will create a "reference number"
which is one higher then the latest one added.
The reference number consist of "2009000100"
which is the year (2009) followed by a 6 figur digit "000100"
The code must create the new reference number as : "2009000101"
</quote>

His reference number is "2009000100" which is a 4 digit year followed by a
6
digit number. The new reference number is to be "2009000101". I can read
it
another dozend times, but that's exactly what my code does.
Which part do I misunderstand? I don't get it.


Armin


I interpreted his desire, that, if the code ran on 31 December 2009 beyond
midnight, that the code needed to handle the change of year. I now
understand your interpretation. I had assumed in your post that you were
only describing the index part, not including the first four digits. Sorry
about my confusion.
 
Armin Zingler said:
That's what I understand, too.


?? I still don't understand what's wrong with my solution.


<quote>
I'm trying to create a function that will create a "reference number"
which is one higher then the latest one added.
The reference number consist of "2009000100"
which is the year (2009) followed by a 6 figur digit "000100"
The code must create the new reference number as : "2009000101"
</quote>

His reference number is "2009000100" which is a 4 digit year followed by a
6
digit number. The new reference number is to be "2009000101". I can read
it
another dozend times, but that's exactly what my code does.
Which part do I misunderstand? I don't get it.


Armin


I interpreted his desire, that, if the code ran on 31 December 2009 beyond
midnight, that the code needed to handle the change of year. I now
understand your interpretation. I had assumed in your post that you were
only describing the index part, not including the first four digits. Sorry
about my confusion.
 
Family said:
I interpreted his desire, that, if the code ran on 31 December 2009
beyond midnight, that the code needed to handle the change of year. I now
understand your interpretation. I had assumed in your post
that you were only describing the index part, not including the first
four digits. Sorry about my confusion.

Yes, I left the year unchanged because he didn't state that it also has to
be changed. I also asked why he uses "Today" in his code - unanswered til
now. Maybe that's the missing part. :)


Armin
 
Family said:
I interpreted his desire, that, if the code ran on 31 December 2009
beyond midnight, that the code needed to handle the change of year. I now
understand your interpretation. I had assumed in your post
that you were only describing the index part, not including the first
four digits. Sorry about my confusion.

Yes, I left the year unchanged because he didn't state that it also has to
be changed. I also asked why he uses "Today" in his code - unanswered til
now. Maybe that's the missing part. :)


Armin
 
Back
Top