Re: Number sequence
- From: Mark G <MarkG@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 18 Aug 2007 17:22:02 -0700
It looks like it also uses "incrementdigit" Here is that one as well.
Function IncrementDigit(c As Byte) As Byte
'{increments a digit in a sequence field. Returns true if there is no carry,
false if another
' carry operation on the next most significant digit must be performed.}
' begin
If (Chr(c) <> "9") And (UCase(Chr(c)) <> "Z") Then
IncrementDigit = c + 1
Else
If c = Asc("9") Then IncrementDigit = Asc("0")
If c = Asc("z") Then IncrementDigit = Asc("a")
If c = Asc("Z") Then IncrementDigit = Asc("A")
End If
End Function
Thanks
Mark
"tina" wrote:
well, i see that the function is using another custom function,.
"AdvanceSequence()". since i don't see anything that would account for the
result you described (07.0000), i think we'll need to see that function
procedure too. find the function, the same way you found the first one, and
post the code, please.
hth
"Mark G" <MarkG@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:49EAB3D6-7744-4531-B6A9-EA910429D52B@xxxxxxxxxxxxxxxx
Thank you for the quick reply, and the instructions. Here is theinformation.
the
Public Function GenNextSequence(TableName, FieldName, Seed)
' gets next sequence value from TableName and FieldName, Seed is the
starting value
Dim rs
On Error Resume Next
Seed = Nz(Seed, "0")
Set rs = CurrentDb.OpenRecordset("Select TOP 1 [" & FieldName & "] as
SeqVal from [" & TableName & "] ORDER BY [" & FieldName & "] DESC")
If Not rs.EOF Then Seed = CStr(IIf(Nz(rs("SeqVal"), "") = "", Seed,
rs("SeqVal")))
GenNextSequence = AdvanceSequence(CStr(Seed))
If Err Then GenNextSequence = "#SeqErr"
rs.Close
Set rs = Nothing
End Function
Thanks
Mark
"tina" wrote:
looks like a custom function: GenNextSequence(). assuming that this is
where the number assignment is actually coming from, we'd need to see
menufunction procedure in order to make recommendations.
open your database, and open any module on the Modules tab. from the
GenNextSequence("bar, click Edit | Find. in the Find dialog, type "Function
Currentonly without the double quotes. in the Search section below, choose
typedProject, then click Find Next.
you should find the function procedure, which starts with the line you
usein (Function may be preceded by Public), and ends with "End Function" -
again, sans quotes. copy the entire procedure from beginning to end, and
paste it into a post, so we can see it.
hth
"Mark G" <MarkG@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:585481AD-82D6-44E9-85B4-BE8570063882@xxxxxxxxxxxxxxxx
We have a field in one of our forms in our database that automatically
generates a run number for fire calls in sequence. The format that we
beenis
07-999. Everything was working fine until we hit what should have
dabble07-1000. Now when it is supposed to assign the next number in thesequence
it displays 07.0000. Any help would be greatly apreciated. I just
thewith access and have no formal training which is more than the rest of
using.department, and since I do I kind of inherited this database we are
thisThis code is in a tab labeled "calculations" on a subform. I think
is
what is telling the field what to do.transition
=GenNextSequence("daylog3","RUN#","05-0001"). I would like it to
from 07-999 to 07-1000 just as it did for the first 999 numbers.
Thanks
Mark
- Follow-Ups:
- Re: Number sequence
- From: tina
- Re: Number sequence
- From: UpRider
- Re: Number sequence
- References:
- Re: Number sequence
- From: tina
- Re: Number sequence
- From: Mark G
- Re: Number sequence
- From: tina
- Re: Number sequence
- Prev by Date: Re: Number sequence
- Next by Date: Re: Number sequence
- Previous by thread: Re: Number sequence
- Next by thread: Re: Number sequence
- Index(es):
Relevant Pages
|
Loading