Recordset "LIKE" filter of a number column
-
I've posted a message here yesterday, but it seems that i was mis-understood. I'm using vb6 ADO's Recordset. i want to use the recordset's Filter property. but the target column is numeric (the ID column of the table, int). i want to filter the table, so i'll stay with the rows that begins with a certain number, just as a varchar column i'll use "LIKE" filter. when trying to do it, i get an error "Filter can not be opened." any ideas? thanks
-
I've posted a message here yesterday, but it seems that i was mis-understood. I'm using vb6 ADO's Recordset. i want to use the recordset's Filter property. but the target column is numeric (the ID column of the table, int). i want to filter the table, so i'll stay with the rows that begins with a certain number, just as a varchar column i'll use "LIKE" filter. when trying to do it, i get an error "Filter can not be opened." any ideas? thanks
you could put a textbox on your form, and in the code, use the textboxes text property in your filter. create a varible and set the val(textbox) = to your varible and search that way ex. dim SQLSearch as integer sqlSearch = Val(Text1.Text) "SELECT Whatever FROM Wherever WHERE Field LIKE '%" & SqlSearch & "%'" the more you type in the textbox, the closer your search will be please note the use of the % in the SQL Query you could even put your search into the textboxes textchange () if your using ado ex. ado.recordsource = "SELECT Whatever FROM Wherever WHERE Field LIKE '%" & SqlSearch & "%'" ado.refresh so as you type, the the search gets smaller Hope this helps Help is great only if you ask correctly :)