You can code as much as you want into an on click event. Are you using a macro or vba? If it's a macro, just keep adding lines to the macro. If it's vba, add DoCmd.close after the sql is executed.
Edit: To clarify, the "On Click" event is only a trigger. You can have as many "commands" as you would like within the "trigger". All that really happens when you put stuff in the onclick event is whenever the button is clicked, it will go through ALL the code that you have written within that event or "sub".