Your select critieria is applied after the join takes place.
Trying to fix that only in crystal can get a a bit tricky.
You can handle this by creating a command or a stored procedure much more simply. Or you can create a view and use it ior you can
Are you linking the AddressFile to the MainFile twice? You shouldn't need to.
YOu can use a subquery on AddressFile and left join to it or you can either apply your criteria to the join
//Join example
select * fom MainFile mf
Left Join AddressFile af ON mf.Empid = mf.Empid and
((af.addresstype='R' and mf.contacttype="") OR (mf.addresstype='M' and mf.contacttype=""))