I have a contact type application, which is based around a tabbed form.
Depending on the type of contact I select the tabs change to different titles.
Each tab contains listboxes. In the listboxes are data relevant to the contact type. On slecting the contact type the listbox is manipulated by SQL statement to show a different content. So far so good.
My problem is that the contact type is dynamic, and therefore subject to change at runtime. Ideally what I would like to do is to add a new sql statement to provide specific list data relevant to that contact. Trouble is I have no idea how this may be acheived?
Sort of. Unfortunately that is not quite the case. FOr example for clients, we show data in the list box about aquatic centres belonging to this client. For Aquatic centres the list box lists pool data, the list box completely changes the displayed data and columns and so on. For suppliers we show a listing of the products provided by them, that we have bought.
For Architects we show clients they have worked with, and the pools they have designed and so on.
In fact the list box, undergoes a complete metamorphis and can change everything including the table from which it retreives data for each contact type.
As you can now see the list box goes through a complete change depending on client type selection.
Hence the question as to how and if it is possible to write some sort of quassi sql at runtime.
It's possible to do it by code, using the dbengine properties, and openning the recordsets. But is more dificult doing it by code, because each client or supplier as you said, requires diferent querys, so you have to open various recordsets, and the number of columns too.
The best way for you to do that, is creating a listbox for each situation, and turn them invisible, so when you need one, just turn it visible.
I have the listboxes working. I have used an alternative approach of writing sql statements which are selected based on categorytype. I then manipulate the column counts, widths and so on from code to suit. This part is working well.
However, the contact type expands. For example since intial install the contct type has had added consulting engineers.
I am trying to think of a way that the user can write a quassi sql statement and therefore customise the list contents to acheive a different oputcome of the listbox.
My thoughts were something like:
1: Set up table for contacts to include the sql statement for the listbox.
2: Set up an editor of some sort to write new sql (The bit I need help with)
3: Populate the listbox using the sql statement by looking up at runtime based on category type.