SQL Query string in regard to blank textbox values

  • Thread starter Thread starter FriQenstein
  • Start date Start date
F

FriQenstein

Guest
Greetings,

I am building a front end GUI that will query a DB for specific purposes. A user can select values from combobox or type in values in a textbox to filter the results of the query (i.e. search for a serial number, etc.)

The problem:

I am having issues figuring out how to ignore blank fields in textboxes/comboboxes for the string.

Let's say I have tbox1 and cmb1. If a user selects a value from cmb1, but nothing in tbox1, I want the query to be able to ignore the null value in tbox1 and still pull the results from the query.

Basically, It is similar to the Access criteria statement: Like '*' & [forms]![form1]![tbox1] & '*'

I have attempted putting in additional if statements to determine if the tbox field is null and to fill it with the LIKE string from above however, it always returns nothing in the results. It is as if the string being used does not get translated into C# the way the SQL handles it.

I hope that makes sense. Any help would be greatly appreciated.

Regards.

Continue reading...
 

Similar threads

Back
Top