Yuri - I think I finally sorted it - the problem appears to have been with my SQL string... I had this "...WHERE Contacts.co_primary = ?vPrimary AND Addresses.ad_default = .t." replaced it with this "...WHERE Contacts.co_primary = " + alltrim(str(vPrimary)) + " AND Addresses.ad_default = 1" and it works - I have a little tidying to do but it works!
Thanks Yuri for you perserverance...