S
Sondra
I have two databases with the same type of On Open Event on one of the forms;
however on one form it isn't work and I'm getting a Runtime Error '94'. I
don't have a clue what this means and because the other one is working I'm
having some problems figuring it out.
here is my Procedure:
Private Sub Form_BeforeInsert(Cancel As Integer)
Dim mTable As String, mField As String, mYearPart As Long, mNextNumber
As Long
'number is returned as 6 characters: YY####
'where YY is the last 2 digits of the year
'#### is the next number for that year
'C is the CSCR Code
'format code to display this number should be "00C-0000"
mTable = "CSCR"
mField = "CSCRNumber"
mYearPart = Right(CStr(Year(Me.CSCRYear)), 2) * 10000
mNextNumber = Nz(DMax(mField, mTable, mField & ">=" & mYearPart), 0)
If mNextNumber = 0 Then
mNextNumber = mYearPart
End If
mNextNumber = mNextNumber + 1
Me.CSCRNumber = mNextNumber
End Sub
The line:
mYearPart = Right(CStr(Year(Me.CSCRYear)), 2) * 10000
is where the Runtime Error is pointing to.
Any help would be appreciated.
Thanks.
however on one form it isn't work and I'm getting a Runtime Error '94'. I
don't have a clue what this means and because the other one is working I'm
having some problems figuring it out.
here is my Procedure:
Private Sub Form_BeforeInsert(Cancel As Integer)
Dim mTable As String, mField As String, mYearPart As Long, mNextNumber
As Long
'number is returned as 6 characters: YY####
'where YY is the last 2 digits of the year
'#### is the next number for that year
'C is the CSCR Code
'format code to display this number should be "00C-0000"
mTable = "CSCR"
mField = "CSCRNumber"
mYearPart = Right(CStr(Year(Me.CSCRYear)), 2) * 10000
mNextNumber = Nz(DMax(mField, mTable, mField & ">=" & mYearPart), 0)
If mNextNumber = 0 Then
mNextNumber = mYearPart
End If
mNextNumber = mNextNumber + 1
Me.CSCRNumber = mNextNumber
End Sub
The line:
mYearPart = Right(CStr(Year(Me.CSCRYear)), 2) * 10000
is where the Runtime Error is pointing to.
Any help would be appreciated.
Thanks.