hiya,
I have a number of validation rules on my table but violation of any of them gives a text message that lists the WHOLE syntax of the rules. The below table rule works until you violate it. Then after you correct the error, the validation text message wouldn't go away
IIf([More MgSO4?]="Yes",Not IsNull([extra dosage]),IsNull([extra dosage]))
I understand that it is better to put the validation rule on the form using VB but I need assistance with the code please. I wrote this code in the AfterUpdate event of [extra dosage] - i.e. the textbox txtExtra but it has bugs. I need assistance with this code please:
Private Sub txtExtra_AfterUpdate()
If [More MgSO4?] = "Yes" Then
If Len([extra dosage].Text & vbNullString) = 0 Then
MsgBox "Please provide the extra dose!", vbOK + vbExclamation
Else
[extra dosage].Text = Me.txtextra.Text
Len([extra dosage].Text) > 0
End If
Else Len([extra dosage].Text) = 0
End If
End Sub