I don't have any examples to hand, and if you've not done much VBA I suggest you do it in small stages so you can see whats working and whats not, before puting all together.
Create an OnClick event from a button that runs the code to build the SQL statement, then display the result in a memo...