Problem with where clause in forms on dashboard


I have the following project: a dashboard with two forms (left and right) with both a different table which are linked with a key in a certain field. The purpose is to link the two tables together. When I scroll through table A (on the left) and I want to see on the right form if there is a record linked with the common key. If not I want on the right to be able to navigate through all the because there shall be a button to link the two together.

I am trying to use the where clause on the right form to show the linked (or all the non-linked) records. In the Where clause of the SQL I put a global variable which I update in the onLoad event of the left table (when navigating through the table). But when activating debug mode on the right form I see that the where clause always have the first key in the where clause and when I change the global variable this becomes an “AND”.

Why is this? How can I completely clear the where clause on the right form? Has this to do with the use of the dashboard? Can I even do something like this with scriptcase?

It gets even more complicated when this works: below the two forms there has to be a grid where the information of the two tables is shown in one record. But first I have to solve this where problem offcoure!

I already looked at sc_select_where macro but that’s for grids I think…

Many thxs