D
dcc15 via AccessMonster.com
Hey Bruce (hope you see this)
I have been trying to apply the code you suggested, but as I probably don't
now what I am doing, it's not working.
Test Table (TBLdmr):
"dmrdate" (Date, General)
"dmrincrnum" (Number, Long Integer)
"dmrnum" (Text)
"partnum" (Text)
I then created a form (FRMdmr) using the wizard.
In design mode, I pasted the code in "Code Builder" on/into the forms "On
Current" event.
When I open the form the code debugger opens with "compile error: expected
sub end" message?
____________________________________________________________
Private Sub dmrincrnum_BeforeUpdate(Cancel As Integer)
End Sub
_____________________________________________________________
Private Sub DMRnum_BeforeUpdate(Cancel As Integer)
End Sub
_____________________________________________________________
Private Sub Form_Current()
Dim strWhere As String, strYrMo As String
Dim varResult As Variant
strYrMo = Format(Me.dmrdate, "yymm")
If Me.NewRecord Then
strWhere = "[dmrincrnum] Like """ & strYrMo & "*"""
varResult = DMax("[dmrincrnum]", "TBLdmr", strWhere)
If IsNull(varResult) Then
Me.dmrincrnum = strYrMo & "0001"
Else
Me.dmrincrnum = Left(varResult, 4) & Format(Val(Right(varResult,
4)) + 1, "0000")
End If
End Sub
______________________________________________________________
The line, "Me.dmrincrnum = Left(varResult, 4) & Format(Val(Right(varResult,
4)) + 1, "0000")" is in RED?
First, am I puting the "code" in the right place? I have no "Default Value"
set in Table or Form.
Thanks
I have been trying to apply the code you suggested, but as I probably don't
now what I am doing, it's not working.
Test Table (TBLdmr):
"dmrdate" (Date, General)
"dmrincrnum" (Number, Long Integer)
"dmrnum" (Text)
"partnum" (Text)
I then created a form (FRMdmr) using the wizard.
In design mode, I pasted the code in "Code Builder" on/into the forms "On
Current" event.
When I open the form the code debugger opens with "compile error: expected
sub end" message?
____________________________________________________________
Private Sub dmrincrnum_BeforeUpdate(Cancel As Integer)
End Sub
_____________________________________________________________
Private Sub DMRnum_BeforeUpdate(Cancel As Integer)
End Sub
_____________________________________________________________
Private Sub Form_Current()
Dim strWhere As String, strYrMo As String
Dim varResult As Variant
strYrMo = Format(Me.dmrdate, "yymm")
If Me.NewRecord Then
strWhere = "[dmrincrnum] Like """ & strYrMo & "*"""
varResult = DMax("[dmrincrnum]", "TBLdmr", strWhere)
If IsNull(varResult) Then
Me.dmrincrnum = strYrMo & "0001"
Else
Me.dmrincrnum = Left(varResult, 4) & Format(Val(Right(varResult,
4)) + 1, "0000")
End If
End Sub
______________________________________________________________
The line, "Me.dmrincrnum = Left(varResult, 4) & Format(Val(Right(varResult,
4)) + 1, "0000")" is in RED?
First, am I puting the "code" in the right place? I have no "Default Value"
set in Table or Form.
Thanks