D
Dedren
I took some code from another database I did and am trying to work it into my
current one, but having some trouble. Here is the code:
If Me.OnClick Then
Dim strWhere As String
Dim varResult As Variant
strWhere = "CaseNum Like """ & Format(Date, "yy") & "*"""
varResult = DMax("CaseNum", "Cases", strWhere)
If IsNull(varResult) Then
Me.CaseNum = Format(Date, "yy") & "-001"
Else
Me.CaseNum = Left(varResult, 3) & _
Format(Val(Right(varResult, 3)) + 1, "000")
End If
End If
DoCmd.Save
I am making an unbound form that the user enters case info into. When they
hit this save button it creates a unique ID number for this case and saves
the case into its respective tables. The code keeps giving me an error at
Me.CaseNum = Format(Date, "yy") & "-001"
saying "Method or Data member not found"
In the old DB it would activate when the form was Dirtied and Current not
sure if that has anything to do with it.
Thanks in advance for any guidance.
current one, but having some trouble. Here is the code:
If Me.OnClick Then
Dim strWhere As String
Dim varResult As Variant
strWhere = "CaseNum Like """ & Format(Date, "yy") & "*"""
varResult = DMax("CaseNum", "Cases", strWhere)
If IsNull(varResult) Then
Me.CaseNum = Format(Date, "yy") & "-001"
Else
Me.CaseNum = Left(varResult, 3) & _
Format(Val(Right(varResult, 3)) + 1, "000")
End If
End If
DoCmd.Save
I am making an unbound form that the user enters case info into. When they
hit this save button it creates a unique ID number for this case and saves
the case into its respective tables. The code keeps giving me an error at
Me.CaseNum = Format(Date, "yy") & "-001"
saying "Method or Data member not found"
In the old DB it would activate when the form was Dirtied and Current not
sure if that has anything to do with it.
Thanks in advance for any guidance.