T
Tom
I have the following formula which is not
working and I need to know what to change.
I did not create this, as I am new. Got it
yesterday from New User Site.
What I have now:
PART I
1. when a new record is created, a field
displays the date in yr/mm/day format,
with an additional 3 numbers
i.e. 051118001
2. when the day changes at midnight,
the number will reflect that change,
i.e. 051119001
Always starting at ....001 (not ever 000)
That part works fine. When midnight rolls around,
the number is changing and starting at ...001.
PART II
When a button is pushed on the form,
it records the data and brings up the
next blank record for input. I have that part.
The Problem:
What I need to have happen with the number:
When the blank record comes up, the
number needs to change to .....002
and so on .....003, .....004, etc.
It just keeps showing as 051118001
Here is the Formula:
Function GetNextNumber() As String
Dim strCurrDate As String
Dim varHighValue As Variant
strCurrDate = Format(Date, "yymmdd")
varHighValue = DMax("[RUN NUMBER]", "ABLE_Table1", "Left([RUN NUMBER], 6) =
'" _
& strCurrDate & "'")
If IsNull(varHighValue) Then
GetNextNumber = strCurrDate & "001"
Else
GetNextNumber = Format(CLng(Left(varHighValue, 6)) + 1, "000000000")
End If
End Function
Any help would be greatly appreciated
Tom
working and I need to know what to change.
I did not create this, as I am new. Got it
yesterday from New User Site.
What I have now:
PART I
1. when a new record is created, a field
displays the date in yr/mm/day format,
with an additional 3 numbers
i.e. 051118001
2. when the day changes at midnight,
the number will reflect that change,
i.e. 051119001
Always starting at ....001 (not ever 000)
That part works fine. When midnight rolls around,
the number is changing and starting at ...001.
PART II
When a button is pushed on the form,
it records the data and brings up the
next blank record for input. I have that part.
The Problem:
What I need to have happen with the number:
When the blank record comes up, the
number needs to change to .....002
and so on .....003, .....004, etc.
It just keeps showing as 051118001
Here is the Formula:
Function GetNextNumber() As String
Dim strCurrDate As String
Dim varHighValue As Variant
strCurrDate = Format(Date, "yymmdd")
varHighValue = DMax("[RUN NUMBER]", "ABLE_Table1", "Left([RUN NUMBER], 6) =
'" _
& strCurrDate & "'")
If IsNull(varHighValue) Then
GetNextNumber = strCurrDate & "001"
Else
GetNextNumber = Format(CLng(Left(varHighValue, 6)) + 1, "000000000")
End If
End Function
Any help would be greatly appreciated
Tom