Validation Rule

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Hi, Im pretty new to coding in visual basic, so I think this may have an
easy solution

I am setting up a basic validation rule for a form I have designed. The code
(so far) is as follows

Private Sub btn_close_Click()
On Error GoTo Err_btn_close_Click

'VALIDATION RULES ----------------------------------------------------

If IsNull(Me![comments]) And [special_conditions] = "y" Or "Y" Then
MsgBox ("Comments cannot be null if there are special conditions")

'VALIDATION RULES ----------------------------------------------------

Else: DoCmd.Close
End If

I keep getting a type mismatch error which I am sure has to do with the "y"
or "Y" but I am not sure what

Any help would be great

Thanks
 
Back
Top