Given a planet that orbits a star, and a moon that orbits that planet, is it possible to define a maximum orbital radius of that moon, beyond which the moon would no longer orbit the planet, but the star instead?
I initially (naively) thought this point would be where the star's gravity outweighed that of the planet:
$$d_\text{max} = d_\mathrm p - d_\mathrm px$$
$$x = \frac{1}{\sqrt{\frac{m_\mathrm p}{m_\mathrm s}}+1}$$
Where:
$d_\text{max} = $ maximum orbital radius of the moon (around the planet), $d_\mathrm p =$ orbital radius of the planet (around the sun), $m_\mathrm p =$ mass of the planet, $m_\mathrm s = $ mass of the star.
But I quickly realised this assumption was wrong (unless my shoddy maths is wrong, which is very possible), because this gives a value of $258\,772\ \mathrm{km}$ using values of the Sun, Moon, and Earth. $125\,627\ \mathrm{km}$ closer to the Earth than the Moon's actual orbital radius (values from Wikipedia).
Is there a maximum orbital distance? How can it be calculated?