This is my first time asking a question here, so I hope I am not missing or ignoring any of the posting rules.
Here is my qustion: I have a function that checks through a series of entry boxes, in this case comboboxes and textboxes to see that the user has entered a value. Basically it checks If (TextBox.value & "") = ""
and returns False if it finds any of them.
I would like to modify this code so that it returns true if I have values in Textbox1 and Combobox1, or if I have values in AAX and AAY. I only need two of the four to make my calculation. I've tried replacing the Or functions with And functions but it doesn't seem to change the functionality of the code.
Thanks in advance for any help!
Code for the function:
Function validate() As Boolean
Dim ret As Boolean
If (TextBox1.Value & "") = "" Or (ComboBox1.Value & "") = "" Or (AAX.Value & "") = "" Or (AAY.Value & "") = "" Or (ComboBox2.Value & "") = "" _
Or (ComboBox3.Value & "") = "" Or (RB.Value & "") = "" Or (MFC.Value & "") = "" Or (MCC.Value & "") = "" Or (LB.Value & "") = "" _
Or (TB.Value & "") = "" Or (BB.Value & "") = "" Or (ComboBox4.Value & "") = "" _
Then
ret = False
Else
ret = True
End If
validate = ret
End Function
Code that calls the function:
Private Sub CommandButton1_Click()
If Not validate() Then
MsgBox "Fill all required fields, please"
Cancel = True
End If
End Sub