View Full Version : form filter problem, please help.


karllo
03-21-2002, 06:33 AM
Hi. I meet this problem and I don't know what's wrong with my code.

I have a main form show customers, and a child form to show orders. The orders have a "orderClosed" field. I put a checkbox "show only active orders" on main form so each time I click the checkbox the childform can show only the orders not closed.

I use the "customer" table as main form record source, and "order" table as the child form record source, and put code in checkbox after_update event and everything works just fine.

But when I change the record source of the child form to "select orderID ... from orders ..", when I click the checkbox, I got a runtime 107 error, it says the property of object not match or something alike.

My filter code is like follows:

IF CHECKBOX = TRUE THEN
ME.CHILD.FORM.FILTER = "...."
ME.CHILD.FORM.FILTERON = TRUE (this line error)
ELSE
.......

And I also try with [Forms]![main]![child].form.filterOn, child.form.filteron, (because the object reference in VBA is very confusing for me), but none of them worked.

I tried to not to write any code but to put the filter string in the design mode in the property window. When use a table as a source, the filter works, but use SQL string, it still failed. The error message shows the name of the child form, and says it does not match the column name of the source.

Anybody here can help? Thanks!


[This message has been edited by karllo (edited 03-21-2002).]