I am trying to make a text field "RMargin" required if the value of the Option Group "ROption" is equal to "1" but blank if "ROption" is either option "2" or has no value selected. This is what I have so far but it conflicts with the search function, should I change from BeforeUpdate to something else to avoid conflicting with the search? The conflict is that the search doesn't work if the "RMargin" field is empty and the user clicks the search button, then the message box pops up preventing the search from completing.
Code:Private Sub Form_BeforeUpdate(Cancel As Integer) If Me.ROption = "1" Then If IsNull(Me.RMargin) Then MsgBox "You must enter a value in the RMargin Field!" Cancel = True Me.RMargin.SetFocus End If End If End Sub Private Sub ROption_AfterUpdate() Me.RMargin.Visible = Me.ROption = 1 Select Case Me![ROption] Case 1 Me![RValue] = "No" Case 2 Me![RValue] = "Yes" End Select End Sub Private Sub SearchItemNumber_Click() Dim S As String S = InputBox("Please Enter Part Number", "Part Number", Item) If S = "" Then Exit Sub Me.Filter = "Item = """ & S & """" Me.FilterOn = True