It surprises me how many times I see this done. I was taught it was bad practice in my early days of MS Access programming, by my mentors. I didn't rightly know why at the time, but as you start to develop more sophisticated code you start to see the sense in it.
If the code is only applicable to the command button, then leave it there. If you need to call it from elsewhere, then you should refactor it into its own method.
Code called from more than one place should not be tied to a particular control. If you rename your command button, the code that is calling the command button event handler will fail.
If you update the code within the command button event handler, you might not be aware that it is being called from elsewhere and introduce a bug.
It's better coding style to have a standalone procedure with a name that indicates what it does.
It's a more elegant solution and is much easier to maintain.
It makes it easy to reuse the code when it is separate from the command button event handler. It is also easier to test and maintain.