If you are spraying a pre-finished moulding, test a bit first to see if the paint sticks properly. Wait until it's dry and try scraping with a fingernail. If it flakes off, it needs a good sanding to give a better 'key'. Even then, some finishes defy all efforts to add paint on top. If you want to use water-based paint (Acrylic?), a light sanding followed by a barrier coat of shellac will give a good base. The shellac will stick to the finish in most cases and being organic and porous, will take a water-based paint successfully.