Hello guys,
New to this forum and new to access programing, my issue is
I am comparing 2 date fields, I have to validate that Order Rcvd Dt should be less then Ord Comp date and Order Comp date cannot be null.
So I written a function to validate the field which is shown below,
If I write before update on Order_comp_date field then I get run time error message : You must save the field before you execute setfocus method
Private Sub Order_Dt_Comp_B eforeUpdate(Can cel As Integer)
If ChkFld = False Then
Cancel = True
End If
End Sub
This is my function
------------------------
Private Function ChkFld()
Dim isValid as Boolean
If (IsNull(Ord_Com p_Dt.Value)) Then
MsgBox "Order Complete Dt cannot be null,Please enter date"
Ord_Comp_Dt.Set Focus
isValid = False
End If
If (Ord_Rcvd_Dt > Ord_Comp_Dt.Val ue) Then
MsgBox "Order Complete Dt should be greater then Order Recv Date!"
Ord_Comp_Dt.Set Focus
isValid = False
End If
ChkFld = isValid
End Function
So my question is how I can overcome this error and I want user to enter the correct value and can't be null and even if just entering date and hitting save button it should also fire at save button too.
Thanks in advance
-visa
New to this forum and new to access programing, my issue is
I am comparing 2 date fields, I have to validate that Order Rcvd Dt should be less then Ord Comp date and Order Comp date cannot be null.
So I written a function to validate the field which is shown below,
If I write before update on Order_comp_date field then I get run time error message : You must save the field before you execute setfocus method
Private Sub Order_Dt_Comp_B eforeUpdate(Can cel As Integer)
If ChkFld = False Then
Cancel = True
End If
End Sub
This is my function
------------------------
Private Function ChkFld()
Dim isValid as Boolean
If (IsNull(Ord_Com p_Dt.Value)) Then
MsgBox "Order Complete Dt cannot be null,Please enter date"
Ord_Comp_Dt.Set Focus
isValid = False
End If
If (Ord_Rcvd_Dt > Ord_Comp_Dt.Val ue) Then
MsgBox "Order Complete Dt should be greater then Order Recv Date!"
Ord_Comp_Dt.Set Focus
isValid = False
End If
ChkFld = isValid
End Function
So my question is how I can overcome this error and I want user to enter the correct value and can't be null and even if just entering date and hitting save button it should also fire at save button too.
Thanks in advance
-visa
Comment