S
Sondra
Module written for BeforeUpdate:
Want the end result to be
001-2005
002-2005
003-2005
Currently the results are:
200-5001
200-5002
200-5003
Where did I go wrong in writing this? I'm a newbie to
Access modules and can't determine where the format is
defined.
Please help.
Dim mTable As String, mField As String, mYearPart As Long,
mNextNumber As Long
'number is returned as 7 characters: ###YYYY
'where YYYY is the year
'### is the next number for that year
'format code to display this number should be "000-000"
mTable = "RMEntry"
mField = "RMNumber"
mYearPart = Right(CStr(Year(Me.RMYear)), 4) * 1000
mNextNumber = Nz(DMax(mField, mTable, mField & ">=" &
mYearPart), 0)
If mNextNumber = 0 Then
mNextNumber = mYearPart
End If
mNextNumber = mNextNumber + 1
Me.RMNumber = mNextNumber
Want the end result to be
001-2005
002-2005
003-2005
Currently the results are:
200-5001
200-5002
200-5003
Where did I go wrong in writing this? I'm a newbie to
Access modules and can't determine where the format is
defined.
Please help.
Dim mTable As String, mField As String, mYearPart As Long,
mNextNumber As Long
'number is returned as 7 characters: ###YYYY
'where YYYY is the year
'### is the next number for that year
'format code to display this number should be "000-000"
mTable = "RMEntry"
mField = "RMNumber"
mYearPart = Right(CStr(Year(Me.RMYear)), 4) * 1000
mNextNumber = Nz(DMax(mField, mTable, mField & ">=" &
mYearPart), 0)
If mNextNumber = 0 Then
mNextNumber = mYearPart
End If
mNextNumber = mNextNumber + 1
Me.RMNumber = mNextNumber