I am having trouble with the following code. I have a form to search for records based on two combo boxes, one for the field " & field & " and the other for the operand "&_ operand &" with a text box for criteria "& criteria &". The fields are both numeric and text so I am trying to use two different statements If,Else. One of the numeric fields is VOLTS, so I tryed this when VOLTS was selected in the combobox and does not return any values. If I choose a text field it runs the second statement fine. May be a better way to do this.
Private Sub Command12_Click()
If " & field & " = VOLTS Then
strSQL = " Select * from master WHERE " & field & "" &_ operand & "" & criteria & ";"
Else
strSQL = " Select * from master WHERE " & field & "" &_ operand & "'" & criteria & "';"
End If
Me.result.RowSource = strSQL
End Sub
Private Sub Command12_Click()
If " & field & " = VOLTS Then
strSQL = " Select * from master WHERE " & field & "" &_ operand & "" & criteria & ";"
Else
strSQL = " Select * from master WHERE " & field & "" &_ operand & "'" & criteria & "';"
End If
Me.result.RowSource = strSQL
End Sub