Two thoughts.
1---Have you seen this search by Allen Browne?
2---Here is code behind a button I use on a form.
I have 1 textbox that can be used to search for numbers or names.
This code just produces Msgbox to show code that would be used to do the search.
Code:
Private Sub btnSearch_Click()
'sample code to show single search box to invoke
'a) sql to find number, or
'b) sql to find name (text)
10 On Error GoTo btnSearch_Click_Error
20
30 If IsNull(Me.txtSearchValue) Or Len(Me.txtSearchValue) = 0 Then
40 MsgBox "You must enter a Value to Search for in the textBox"
50 Me.txtSearchValue.SetFocus
60 Exit Sub
70 End If
80 If Left(Me.txtSearchValue, 1) Like "[0-9]" Then
'searching for number
90 MsgBox "Use code to search for Number " & vbCrLf _
& "select * from tblEmployees where [employee number] =" & CLng(Me.txtSearchValue)
100 Else
'searching for Name
110 MsgBox "Use code to search for Surname " & vbCrLf _
& "select * from tblEmployees where [name] = '" & Me.txtSearchValue & "'"
120 End If
btnSearch_Click_Exit:
130 Exit Sub
btnSearch_Click_Error:
140 MsgBox "Error " & err.number & " in line " & Erl & " (" & err.Description & ") in procedure btnSearch_Click of VBA Document Form_frmSearchNumberOrName"
150 Resume btnSearch_Click_Exit
End Sub