I have been hunting for a solution for this for two months and have yet to find it!
I have a VB application which allows the user to select one, any combination or all five variables to search on (Owner's name, Attorney's name, State, Company Type and Accounting Firm used). The report to be returned is always the same, and lists the Company Name, whether organized or authorized for business within a state (represented by an "O" or an "A"
, the State the company is organized/authorized in, and their attorney.
I know how to write the queries to find any single criteria, but I don't understand how to write it if the user selects more than one. In code I can test to see what values they have selected and which are blank, but HOW do I assemble a SQL statement on-the-fly to limit the result set??? What I need is to create an "AND" search without knowing in advance what the "AND's" are!
And let's complicate it just a little more, the four fields in the report come from 3 different tables, and the balance of the database to be searched is comprised of another 8 or so tables in a hierarchical fashion with four levels of hierarchy!
Can someone help me!?! This is the final piece in the application which is supposed to be delivered next Monday!
I have a VB application which allows the user to select one, any combination or all five variables to search on (Owner's name, Attorney's name, State, Company Type and Accounting Firm used). The report to be returned is always the same, and lists the Company Name, whether organized or authorized for business within a state (represented by an "O" or an "A"
I know how to write the queries to find any single criteria, but I don't understand how to write it if the user selects more than one. In code I can test to see what values they have selected and which are blank, but HOW do I assemble a SQL statement on-the-fly to limit the result set??? What I need is to create an "AND" search without knowing in advance what the "AND's" are!
And let's complicate it just a little more, the four fields in the report come from 3 different tables, and the balance of the database to be searched is comprised of another 8 or so tables in a hierarchical fashion with four levels of hierarchy!
Can someone help me!?! This is the final piece in the application which is supposed to be delivered next Monday!