Requiring entry in a text field if either No or NA is chosen in the option group

Wag2016

Registered User.
Local time
Today, 15:13
Joined
Mar 5, 2016
Messages
24
Good morning!

Thank you all for being such a great resource, I have learned more from this website than anywhere else. Sometimes I don't even have a issue to research, I just come to learn new things.

I do have an issue today and would appreciate any help you can give me.

I am working on a checklist with twenty questions on it. Each question has an option group with 3 options, Yes (1), No (2), and NA (3) and is called [SQ]. There is also a text field, called [SQRemark]. Each question has a number, so it would be SQ1 and SQ1Remark, etc.

I have written some code to make the SQRemark field required if No or NA options are chosen. I thought it worked, but in testing it is making the SQRemark field required even if Yes is chosen.

Here is the code:

Code:
If SQ2 = 2 Or 3 Then
 If IsNull(SQ2Remark) Then
  MsgBox "Remarks are required for No or NA choices. Please fill in a remark.", vbInformation, "Remark Required"
  Cancel = True
  Me.SQ2Remark.SetFocus
Me.SQ2Remark.BackColor = vbRed
  Exit Sub
  End If
End If

Can anyone tell me what I am doing wrong? I only want the SQRemark field to be filled in with No or NA choices. :banghead:

Thank you very much.
Laura
 
The test would be:

If SQ2 = 2 Or SQ2 = 3 Then
 

Users who are viewing this thread

Back
Top Bottom