I think my question is general enough to not require posting the DDL. I am and will be writing queries for menus that have two comboboxes. I currently have a menu where the user can make a selection from either DBLookupComboBox1, DBLookupComboBox2, or both. Each combobox is filled from tables. In the below query snippet, :DBLookupComboBox1 and :DBLookupComboBox2 are parameters containing the values of the selections. They contain column values from the tables and are used in the query. The selections are blank for no selection. There is no “none” selection. The first combobox has an alphanumeric value. The second has a numeric value. I have to check for null on both. The first WHERE clause with alphanumeric works. How would I check the second box with a numeric value for null?
SELECT TT.DOCTOR, TP.Patient_No, FROM treat TT Inner Join typepatient TP on TT.ednum = TP.Ednum Where (:DBLookupComboBox1 Is Null) or (BL.ChargeName = :DBLookupComboBox1) And (:DBLookupComboBox2 Is Null) or (TT.Dr_ID = :DBLookupComboBox2)
I’ve tried without success:
And (IsNull(:DBLookupComboBox2,0) = 0) or (TT.Dr_ID =:DBLookupComboBox2)
I did get it to work by initializing the value to zero when the menu first loads and then checking for zero in the query. I would like to see if I can just check it in the query.
Let me know if you need the DDL or more info.
Thanks