tab view and selecting data row

I have a tab view with 2 tabs. Both tabs have table views.
I have a click handler attached to each table to get the selected data row

set selectedDataRow to selected data row of myTableView

This works for the tab that is initially opened with the app. When I select the other tab I get an error like:

Can't make «class