>I am trying to create a view that has two behaviors.
>
>The view is based on two tables. The underlying SQL will retrieve only those records in which there is a match between the two tables. That is, if there is a record in one table that does not have a corresponding match in the other, then it will not be pulled. The two tables are joined on a Primary/Foreign key combination.
>
>Including a UNION SELECT I can obtain the non-matched records. I have to use the macro technique to create the view rather than use the view designer since the view designer is weak.
>
>My problem is that when I call the view I would like an option that I can set at run-time to ask for just the non-matched records or all of the records. I cannot think of any way to do IF testing in a view.
Use 2 views. I do the same where I have 2 views but only 1 is in use at a time in a form with a private DS. When I open either view, I alias the view with same alias regardless of the view name. That way I do not have to change the ControlSource of any of the form controls.
if SomeLogicalCriteria
Use MyView1 alias MyView
else
Use MyView2 alias MyView
endif
Mark McCasland
Midlothian, TX USA