I have code I place in BeforeUpdate on forms to check for blank and null for what I determine as mandatory fields.
I have a subform which carries a salesid from the main form. I have the default value of salesid on the subform referring to the salesid on the main form. The ID is one entry is completed on the main form first, so I must ensure this happens.
I have tried to place code in various places on the main and subform ie Open, Load, Close, Lost Focus etc. but I cannot get a message to appear before someone clicks a subform field first. Where should the code be placed.
The code would be - or a variation of:
If IsNull(Me.SalesSaleDate) Or Me.SalesSaleDate = "" Then
MsgBox "You MUST enter the service name. This field is mandatory. If you do not complete, your records will not be saved correctly!", vbOKOnly + vbCritical, "Error"
Me.SalesSaleDate.SetFocus
End
End If
Thank you
I have a subform which carries a salesid from the main form. I have the default value of salesid on the subform referring to the salesid on the main form. The ID is one entry is completed on the main form first, so I must ensure this happens.
I have tried to place code in various places on the main and subform ie Open, Load, Close, Lost Focus etc. but I cannot get a message to appear before someone clicks a subform field first. Where should the code be placed.
The code would be - or a variation of:
If IsNull(Me.SalesSaleDate) Or Me.SalesSaleDate = "" Then
MsgBox "You MUST enter the service name. This field is mandatory. If you do not complete, your records will not be saved correctly!", vbOKOnly + vbCritical, "Error"
Me.SalesSaleDate.SetFocus
End
End If
Thank you